📄 mcthb.frm
字号:
Else
End If
Rst.MoveNext
If Not Rst.EOF() Then
Text1.Text = Rst.Fields("dm").Value
Text2.Text = Rst.Fields("xm").Value
Combo1.Text = Rst.Fields("xb").Value
Text4.Text = Rst.Fields("ll").Value
Text5.Text = Rst.Fields("cjgz").Value
Text6.Text = Rst.Fields("gl").Value
Text7.Text = Rst.Fields("zc").Value
Text8.Text = Rst.Fields("zw").Value
Text9.Text = Rst.Fields("zzmm").Value
Text10.Text = Rst.Fields("zz").Value
Text11.Text = Rst.Fields("lxdh").Value
Text12.Text = Rst.Fields("bz").Value
Label16.Caption = Rst.AbsolutePosition
Label14.Caption = Rst.RecordCount
Else
Rst.MoveFirst
Text1.Text = Rst.Fields("dm").Value
Text2.Text = Rst.Fields("xm").Value
Combo1.Text = Rst.Fields("xb").Value
Text4.Text = Rst.Fields("ll").Value
Text5.Text = Rst.Fields("cjgz").Value
Text6.Text = Rst.Fields("gl").Value
Text7.Text = Rst.Fields("zc").Value
Text8.Text = Rst.Fields("zw").Value
Text9.Text = Rst.Fields("zzmm").Value
Text10.Text = Rst.Fields("zz").Value
Text11.Text = Rst.Fields("lxdh").Value
Text12.Text = Rst.Fields("bz").Value
Label16.Caption = Rst.AbsolutePosition
Label14.Caption = Rst.RecordCount
End If
Command1.Enabled = True
Command3.Enabled = True
Command4.Enabled = False
Command8.Enabled = True
Command9.Enabled = True
Command6.Enabled = True
Command7.Enabled = True
End Sub
Private Sub Command3_Click()
Command1.Enabled = False
Command4.Enabled = True
Command2.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Text1.Enabled = True
Text2.Enabled = True
Combo1.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
Text7.Enabled = True
Text8.Enabled = True
Text9.Enabled = True
Text10.Enabled = True
Text11.Enabled = True
Text12.Enabled = True
If Command3.Caption = "修改" Then
Text1.Text = Rst.Fields("dm").Value
Text2.Text = Rst.Fields("xm").Value
Combo1.Text = Rst.Fields("xb").Value
Text4.Text = Rst.Fields("ll").Value
Text5.Text = Rst.Fields("cjgz").Value
Text6.Text = Rst.Fields("gl").Value
Text7.Text = Rst.Fields("zc").Value
Text8.Text = Rst.Fields("zw").Value
Text9.Text = Rst.Fields("zzmm").Value
Text10.Text = Rst.Fields("zz").Value
Text11.Text = Rst.Fields("lxdh").Value
Text12.Text = Rst.Fields("bz").Value
Command3.Caption = "确定"
Else
Rst.Fields("dm") = Trim(Text1.Text)
Rst.Fields("xm") = Trim(Text2.Text)
Rst.Fields("xb") = Trim(Combo1.Text)
Rst.Fields("ll") = Trim(Text4.Text)
Rst.Fields("cjgz") = Trim(Text5.Text)
Rst.Fields("gl") = Trim(Text6.Text)
Rst.Fields("zc") = Trim(Text7.Text)
Rst.Fields("zw") = Trim(Text8.Text)
Rst.Fields("zzmm") = Trim(Text9.Text)
Rst.Fields("zz") = Trim(Text10.Text)
Rst.Fields("lxdh") = Trim(Text11.Text)
Rst.Fields("bz") = Trim(Text12.Text)
Rst.Update
MsgBox "修改成功!"
Command3.Caption = "修改"
Command1.Enabled = True
Command2.Enabled = True
Command4.Enabled = False
Command6.Enabled = True
Command7.Enabled = True
Command8.Enabled = True
Command9.Enabled = True
End If
End Sub
Private Sub Command4_Click()
Text1.Enabled = False
Text2.Enabled = False
Combo1.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Text9.Enabled = False
Text10.Enabled = False
Text11.Enabled = False
Text12.Enabled = False
Rst.MoveFirst
Text1.Text = Rst.Fields("dm").Value
Text2.Text = Rst.Fields("xm").Value
Combo1.Text = Rst.Fields("xb").Value
Text4.Text = Rst.Fields("ll").Value
Text5.Text = Rst.Fields("cjgz").Value
Text6.Text = Rst.Fields("gl").Value
Text7.Text = Rst.Fields("zc").Value
Text8.Text = Rst.Fields("zw").Value
Text9.Text = Rst.Fields("zzmm").Value
Text10.Text = Rst.Fields("zz").Value
Text11.Text = Rst.Fields("lxdh").Value
Text12.Text = Rst.Fields("bz").Value
Label16.Caption = Rst.AbsolutePosition
Label14.Caption = Rst.RecordCount
Command1.Visible = True
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command3.Caption = "修改"
Command1.Caption = "添加"
Command6.Enabled = True
Command7.Enabled = True
Command8.Enabled = True
Command9.Enabled = True
Command4.Enabled = False
Command5.Visible = False
End Sub
Private Sub Command6_Click()
Text1.Enabled = False
Text2.Enabled = False
Combo1.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Text9.Enabled = False
Text10.Enabled = False
Text11.Enabled = False
Text12.Enabled = False
Rst.MoveFirst
Text1.Text = Rst.Fields("dm").Value
Text2.Text = Rst.Fields("xm").Value
Combo1.Text = Rst.Fields("xb").Value
Text4.Text = Rst.Fields("ll").Value
Text5.Text = Rst.Fields("cjgz").Value
Text6.Text = Rst.Fields("gl").Value
Text7.Text = Rst.Fields("zc").Value
Text8.Text = Rst.Fields("zw").Value
Text9.Text = Rst.Fields("zzmm").Value
Text10.Text = Rst.Fields("zz").Value
Text11.Text = Rst.Fields("lxdh").Value
Text12.Text = Rst.Fields("bz").Value
Label16.Caption = Rst.AbsolutePosition
End Sub
Private Sub Command7_Click()
Text1.Enabled = False
Text2.Enabled = False
Combo1.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Text9.Enabled = False
Text10.Enabled = False
Text11.Enabled = False
Text12.Enabled = False
Rst.MoveLast
Text1.Text = Rst.Fields("dm").Value
Text2.Text = Rst.Fields("xm").Value
Combo1.Text = Rst.Fields("xb").Value
Text4.Text = Rst.Fields("ll").Value
Text5.Text = Rst.Fields("cjgz").Value
Text6.Text = Rst.Fields("gl").Value
Text7.Text = Rst.Fields("zc").Value
Text8.Text = Rst.Fields("zw").Value
Text9.Text = Rst.Fields("zzmm").Value
Text10.Text = Rst.Fields("zz").Value
Text11.Text = Rst.Fields("lxdh").Value
Text12.Text = Rst.Fields("bz").Value
Label16.Caption = Rst.AbsolutePosition
End Sub
Private Sub Command9_Click()
Text1.Enabled = False
Text2.Enabled = False
Combo1.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Text9.Enabled = False
Text10.Enabled = False
Text11.Enabled = False
Text12.Enabled = False
If (Not Rst.EOF) Then
Rst.MoveNext
If (Not Rst.EOF) Then
Text1.Text = Rst.Fields("dm").Value
Text2.Text = Rst.Fields("xm").Value
Combo1.Text = Rst.Fields("xb").Value
Text4.Text = Rst.Fields("ll").Value
Text5.Text = Rst.Fields("cjgz").Value
Text6.Text = Rst.Fields("gl").Value
Text7.Text = Rst.Fields("zc").Value
Text8.Text = Rst.Fields("zw").Value
Text9.Text = Rst.Fields("zzmm").Value
Text10.Text = Rst.Fields("zz").Value
Text11.Text = Rst.Fields("lxdh").Value
Text12.Text = Rst.Fields("bz").Value
Label16.Caption = Rst.AbsolutePosition
Else
Rst.MoveLast
Text1.Text = Rst.Fields("dm").Value
Text2.Text = Rst.Fields("xm").Value
Combo1.Text = Rst.Fields("xb").Value
Text4.Text = Rst.Fields("ll").Value
Text5.Text = Rst.Fields("cjgz").Value
Text6.Text = Rst.Fields("gl").Value
Text7.Text = Rst.Fields("zc").Value
Text8.Text = Rst.Fields("zw").Value
Text9.Text = Rst.Fields("zzmm").Value
Text10.Text = Rst.Fields("zz").Value
Text11.Text = Rst.Fields("lxdh").Value
Text12.Text = Rst.Fields("bz").Value
Label16.Caption = Rst.AbsolutePosition
MsgBox "这是最后一条记录!"
End If
End If
End Sub
Private Sub Command8_Click()
Text1.Enabled = False
Text2.Enabled = False
Combo1.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Text9.Enabled = False
Text10.Enabled = False
Text11.Enabled = False
Text12.Enabled = False
Label16.Caption = Rst.AbsolutePosition
If (Not Rst.BOF) Then
Rst.MovePrevious
If (Not Rst.BOF) Then
Text1.Text = Rst.Fields("dm").Value
Text2.Text = Rst.Fields("xm").Value
Combo1.Text = Rst.Fields("xb").Value
Text4.Text = Rst.Fields("ll").Value
Text5.Text = Rst.Fields("cjgz").Value
Text6.Text = Rst.Fields("gl").Value
Text7.Text = Rst.Fields("zc").Value
Text8.Text = Rst.Fields("zw").Value
Text9.Text = Rst.Fields("zzmm").Value
Text10.Text = Rst.Fields("zz").Value
Text11.Text = Rst.Fields("lxdh").Value
Text12.Text = Rst.Fields("bz").Value
Label16.Caption = Rst.AbsolutePosition
Else
Rst.MoveFirst
Text1.Text = Rst.Fields("dm").Value
Text2.Text = Rst.Fields("xm").Value
Combo1.Text = Rst.Fields("xb").Value
Text4.Text = Rst.Fields("ll").Value
Text5.Text = Rst.Fields("cjgz").Value
Text6.Text = Rst.Fields("gl").Value
Text7.Text = Rst.Fields("zc").Value
Text8.Text = Rst.Fields("zw").Value
Text9.Text = Rst.Fields("zzmm").Value
Text10.Text = Rst.Fields("zz").Value
Text11.Text = Rst.Fields("lxdh").Value
Text12.Text = Rst.Fields("bz").Value
Label16.Caption = Rst.AbsolutePosition
MsgBox "这是第一条记录!"
End If
End If
End Sub
Private Sub Command5_Click()
'Set Rst = CreateObject("ADODB.Recordset")
If (Rst.State = adStateOpen) Then
Rst.Close
End If
Rst.CursorLocation = adUseClient
Rst.Open "Select * From zymc3", Conn, adOpenKeyset, adLockPessimistic
Rst.AddNew
Rst.Fields("dm").Value = Text1.Text
Rst.Fields("xm").Value = Text2.Text
Rst.Fields("xb").Value = Combo1.Text
Rst.Fields("ll").Value = Text4.Text
Rst.Fields("cjgz").Value = Text5.Text
Rst.Fields("gl").Value = Text6.Text
Rst.Fields("zc").Value = Text7.Text
Rst.Fields("zw").Value = Text8.Text
Rst.Fields("zzmm").Value = Text9.Text
Rst.Fields("zz").Value = Text10.Text
Rst.Fields("lxdh").Value = Text11.Text
Rst.Fields("bz").Value = Text12.Text
Label16.Caption = Rst.AbsolutePosition
Label14.Caption = Rst.RecordCount
Rst.Update
MsgBox "添加成功!"
Command1.Visible = True
Command5.Visible = False
Command3.Enabled = True
Command4.Enabled = False
Command2.Enabled = True
Command8.Enabled = True
Command9.Enabled = True
Command6.Enabled = True
Command7.Enabled = True
End Sub
Private Sub Command10_Click()
Rst.Close
Unload Me
Form1.Show
End Sub
Private Sub Form_Load()
Command5.Visible = False
Command4.Enabled = False
Text1.Enabled = False
Text2.Enabled = False
Combo1.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Text9.Enabled = False
Text10.Enabled = False
Text11.Enabled = False
Text12.Enabled = False
Combo1.AddItem "男", 0
Combo1.AddItem "女", 1
Dim ConString As String
ConString = "Provider=Microsoft.Jet.OleDb.4.0;Persist Security Info = False;" _
& "Data Source =" & App.Path & "\db1.mdb;Jet OleDb:DataBase Password=123456"
Set Conn = CreateObject("ADODB.Connection")
With Conn
.ConnectionString = ConString
.Open
End With
Rst.CursorLocation = adUseClient
Rst.Open "Select * From zymc3", Conn, adOpenKeyset, adLockPessimistic, adCmdText
If Rst.RecordCount > 0 Then
Text1.Text = Rst.Fields("dm").Value
Text2.Text = Rst.Fields("xm").Value
Combo1.Text = Rst.Fields("xb").Value
Text4.Text = Rst.Fields("ll").Value
Text5.Text = Rst.Fields("cjgz").Value
Text6.Text = Rst.Fields("gl").Value
Text7.Text = Rst.Fields("zc").Value
Text8.Text = Rst.Fields("zw").Value
Text9.Text = Rst.Fields("zzmm").Value
Text10.Text = Rst.Fields("zz").Value
Text11.Text = Rst.Fields("lxdh").Value
Text12.Text = Rst.Fields("bz").Value
Label16.Caption = Rst.AbsolutePosition
Label14.Caption = Rst.RecordCount
Else
Text1.Text = ""
Text2.Text = ""
Combo1.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -