VB QQ群:47715789
Private Sub Cmdfind_Click()
datH.Recordset.FindFirst "Name= '" & txtN.Text & "'"
If datH.Recordset.NoMatch = True Then
MsgBox "没有查找到!"
datH.Refresh
End If
End Sub
Private Sub Command1_Click()
datH.Recordset.MovePrevious
If datH.Recordset.BOF = True Then
datH.Recordset.MoveFirst
End If
End Sub
Private Sub Command2_Click()
datH.Recordset.MoveNext
If datH.Recordset.EOF = True Then
datH.Recordset.MoveLast
End If
End Sub
Private Sub Command3_Click()
datH.Recordset.AddNew
datH.Recordset.Update
datH.Recordset.MoveLast
End Sub
Private Sub Command4_Click()
With datH.Recordset
If .RecordCount > 1 Then
If MsgBox("确定删除吗?", vbYesNo, "提示信息") = vbYes Then
.Delete
.MoveNext
If .EOF = True Then
.MoveLast
End If
End If
Else
MsgBox "库中只剩最一条记录,不能删除!"
End If
End With
End Sub
Private Sub Form_Load()
Dim str As String '定义
str = App.Path
If Right(str, 1) <> "\" Then
str = str + "\"
End If
datH.DatabaseName = str & "\Address01.mdb"
datH.RecordSource = "通讯录"
datH.Refresh
End Sub
Private Sub txtExit_Click()
End
End Sub
谁需要自己来拿
Private Sub cmdExit_Click()
End
End Sub
Private Sub cmdFind_Click()
datH.Recordset.FindFirst "Name='" & txtN.Text & " ' "
If datH.Recordset.NoMatch = True Then
MsgBox "没有查找到!"
datH.Rerfresh
End If
End Sub
Private Sub Command1_Click()
datH.Recordset.MovePrevious
If datH.Recordset.BOF = True Then
datH.Recordset.MoveFirst
End If
End Sub
Private Sub Command2_Click()
datH.Recordset.MoveNext
If datH.Recordset.EOF = True Then
datH.Recordset.MoveLast
End If
End Sub
Private Sub Command3_Click()
datH.Recordset.AddNew
datH.Recordset.Update
datH.Recordset.MoveLast
End Sub
Private Sub Command4_Click()
With datH.Recordset
If .RecordCount > 1 Then
If MsgBox("确定删除吗?", vbYesNo, "提示信息") = vbYes Then
.Delete
.MoveNext
If .EOF = True Then
.MoveLast
End If
End If
Else
MsgBox "库中只剩最后一条记录,不能删除!"
End If
End With
End Sub
嗯
最基本的命令和代码,有谁需要用自己看
Private Sub cmdA_Click()
With datH.Recordset
.AddNew
.Update
.MoveLast
End With
End Sub
Private Sub cmdD_Click()
If datH.Recordset.RecordCount <> 1 Then
datH.Recordset.Delete
If datH.Recordset.EOF Then
datH.Recordset.MoveNext
End If
datH.Refresh
Else
MsgBox "最后一条不能再则除", vbOKOnly, "信息提示"
End If
End Sub
Private Sub cmdE_Click()
End
End Sub
Private Sub cmdF_Click()
datH.Recordset.FindFirst "姓名='" & txtN.Text & "'"
If datH.Recordset.NoMatch = True Then
MsgBox "没有查找到!"
datH.Refresh
End If
End Sub
Private Sub cmdR_Click()
datH.Refresh
End Sub
Private Sub Form_Load()
Dim str As String '定义
str = App.Path
If Right(str, 1) <> "\" Then
str = str + "\"
End If
datH.DatabaseName = str & "123.mdb"
datH.RecordSource = "校友通讯录"
datH.Refresh
End Sub