在此代码上收到错误消息其他正在运行
Private Sub Command11FindLastName_Click()
On Error GoTo Err_FindLastName_Click
Dim Searchstr
Dim Resp
BeginSearch:
Searchstr = Left(InputBox("Enter Last Name"), 11)
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tblRecords", dbOpenDynaset)
rst.FindFirst ("[Last Name] = " & Searchstr & "")
If rst.NoMatch Then
Resp = MsgBox("Last Name " & Searchstr & " not found. New Search?", vbYesNo)
If Resp = vbYes Then
GoTo BeginSearch
End If
Else
Me.Filter = "((tblRecords.[Last Name] = " & Searchstr & "))"
Me.FilterOn = True
Me.Refresh
DoCmd.Close acForm, "MainMenu"
End If
Exit_FindSSN_Click:
Exit Sub
Err_FindSSN_Click:
MsgBox Err.Description
Resume Exit_FindLastName_Click
End Sub