Hi there,
I have a form to search for staff by pay number but if there is no match the code I have will show the first record which I dont want.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Pay Number] = '" & Me![Text1] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
I tried the following to give me a message box and the text boxes to go to new record.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Pay Number] = '" & Me![Text1] & "'"
If Not rs.EOF Then
MsgBox "cant find paynumber"
DoCmd.GoToRecord , , acNewRec
Forms!formJobDescriptions!FormStaffLookup!Text1.DefaultValue = ""
End If
but the message box always pops up even when the pay number is right. Can anyone help me modify it please.
I have a form to search for staff by pay number but if there is no match the code I have will show the first record which I dont want.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Pay Number] = '" & Me![Text1] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
I tried the following to give me a message box and the text boxes to go to new record.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Pay Number] = '" & Me![Text1] & "'"
If Not rs.EOF Then
MsgBox "cant find paynumber"
DoCmd.GoToRecord , , acNewRec
Forms!formJobDescriptions!FormStaffLookup!Text1.DefaultValue = ""
End If
but the message box always pops up even when the pay number is right. Can anyone help me modify it please.