牛b 现在地学生啊,太懒了吧
分太少啊
是呀加到200分,就加我QQ:451919575
下次我两都再线时发给你,是用VB+Access作的,有源码。
登录名:方海玉 密码001
部分源码:
Private Sub CmdSave_Click()
Dim I, j As Integer
Dim Index As Integer
Dim TT As String
Dim TT2 As String
Select Case CmdSave.Caption
Case "存盘"
If Len(Trim(Text1(0))) = 0 Then
MsgBox "姓名不能为空!请输入!!! ", vbOKOnly + vbExclamation, "信息帮助"
Text1(0).SetFocus
Exit Sub
End If
If Len(Trim(Text1(1))) = 0 Then
MsgBox "单位不能为空!请输入!!! ", vbOKOnly + vbExclamation, "信息帮助"
Text1(1).SetFocus
Exit Sub
End If
Select Case intActionType
Case conActionNew
StrSql = "INSERT INTO c002(f001,f002,f003,f004,f005,f006,f007,f008,f009,f010,f011,f012,f013,f014,f015)" _
& " VALUES('" & Trim(Text1(0)) & "','" & Trim(Text1(1)) & "','" & Trim(Text1(2)) & "','" & Trim(Text1(3)) & "','" _
& Trim(Text1(4)) & "','" & Trim(Text1(5)) & "','" & Trim(Text1(6)) & "','" & Trim(Text1(7)) & "','" _
& Trim(Text1(8)) & "','" & Trim(Text1(9)) & "','" & Trim(Text1(10)) & "','" & Trim(Text1(11)) & "','" _
& Trim(Text1(12)) & "','" & Trim(Text1(13)) & "','" _
& IIf(Len(Lov_list("c003", "f002", "f001", Trim(Cbo1))) = 0, "", Lov_list("c003", "f002", "f001", Trim(Cbo1))) & "')"
On Error GoTo ErrorHandle
'MsgBox StrSql
adoCon.Execute StrSql
On Error GoTo 0
With MSFlex
.Enabled = True
.Tag = True
If Not (.Rows = 2 And .TextMatrix(1, 1) = "" And .TextMatrix(1, 2) = "") Then
.AddItem ("")
End If
For I = 1 To 15
.ColAlignment(I) = flexAlignLeftCenter
If I = 15 Then
.TextMatrix(.Rows - 1, I - 1) = Cbo1
ElseIf I = 14 Then
.TextMatrix(.Rows - 1, I + 1) = IIf(IsNull(Trim(Text1(I - 1))), "", Trim(Text1(I - 1)))
Else
.TextMatrix(.Rows - 1, I) = IIf(IsNull(Trim(Text1(I - 1))), "", Trim(Text1(I - 1)))
End If
Next I
intCurrentRow = .Rows - 1
intCurrentCol = 0
.ColSel = .Cols - 1
.Row = .Rows - 1
.ColSel = .Cols - 1
.TopRow = .Rows - 1
.SetFocus
End With
MSFlex.Row = MSFlex.Rows - 1
MSFlex_RowColChange
intActionType = conActionNormal
Case conActionEdit
StrSql = "UPDATE c002 SET " _
& "f001= '" & Trim(Text1(0)) & "'," _
& "f002= '" & Trim(Text1(1)) & "'," _
& "f003= '" & Trim(Text1(2)) & "'," _
& "f004= '" & Trim(Text1(3)) & "'," _
& "f005= '" & Trim(Text1(4)) & "'," _
& "f006= '" & Trim(Text1(5)) & "'," _
& "f007= '" & Trim(Text1(6)) & "'," _
& "f008= '" & Trim(Text1(7)) & "'," _
& "f009= '" & Trim(Text1(8)) & "'," _
& "f010= '" & Trim(Text1(9)) & "'," _
& "f011= '" & Trim(Text1(10)) & "'," _
& "f012= '" & Trim(Text1(11)) & "'," _
& "f013= '" & Trim(Text1(12)) & "'," _
& "f014= '" & Trim(Text1(13)) & "'," _
& "f015= '" & IIf(Len(Lov_list("c003", "f002", "f001", "" & Trim(Cbo1) & "")) = 0, "", Lov_list("c003", "f002", "f001", "" & Trim(Cbo1) & "")) & "'" _
& " where f001='" & strEdit(0) & "' and f002='" & strEdit(1) & "'"
'MsgBox StrSql
On Error GoTo ErrorHandle
adoCon.Execute StrSql
On Error GoTo 0
With MSFlex
For I = 1 To 15
.ColAlignment(I) = flexAlignLeftCenter
If I = 15 Then
.TextMatrix(.Rows - 1, I - 1) = Cbo1
ElseIf I = 14 Then
.TextMatrix(.Row, I + 1) = IIf(IsNull(Trim(Text1(I - 1))), "", Trim(Text1(I - 1)))
Else
.TextMatrix(.Row, I) = IIf(IsNull(Trim(Text1(I - 1))), "", Trim(Text1(I - 1)))
End If
Next I
End With
intActionType = conActionNormal
End Select
strEdit(0) = ""
strEdit(1) = ""
Text1(1).SetFocus
MSFlex.Enabled = True
CmdSave.Enabled = False
Cancel_Click
Case "执行"
' Find_click
End Select
Exit Sub
ErrorHandle:
Dim Er As ADODB.Error
For Each Er In adoCon.Errors
If Er.SQLState = 3022 Then
MsgBox "此名片记录已存在,请输入一条新记录! ", vbCritical, "错误信息"
Exit Sub
End If
intresult = MsgBox(Er.Description & " " & Er.SQLState, vbCritical, "错误信息")
Next Er
End Sub