I have a query based continuous form that looks up a serial number entered by the user and allows them to view the matching data.
When a user enters a serial number that is not in the database I want a message box to pop up to warn them there is no match.
The code I am using makes the msgbox pop up on every entry. I have tried to put this code in a variety of form and control events with no luck. Can someone tell me what I am doing wrong?
Private Sub Form_AfterUpdate()
Dim intRespone As Integer
If DCount("[packing station scan].[serial_number]", "match with last test results", _
"[drive test results].[serial_number] = ' & Forms![match with last test results].[Serial_Number] & '") < 1 _
Then
intresponse = MsgBox("Stop! Serial Number has no test data!", vbYesNo, "No data found")
Select Case intresponse
Case vbYes
DoCmd.Requery
Case vbNo
DoCmd.Requery
End Select
End If
End Sub
Any help is greatly appreciated!
Regards,
Kerry
When a user enters a serial number that is not in the database I want a message box to pop up to warn them there is no match.
The code I am using makes the msgbox pop up on every entry. I have tried to put this code in a variety of form and control events with no luck. Can someone tell me what I am doing wrong?
Private Sub Form_AfterUpdate()
Dim intRespone As Integer
If DCount("[packing station scan].[serial_number]", "match with last test results", _
"[drive test results].[serial_number] = ' & Forms![match with last test results].[Serial_Number] & '") < 1 _
Then
intresponse = MsgBox("Stop! Serial Number has no test data!", vbYesNo, "No data found")
Select Case intresponse
Case vbYes
DoCmd.Requery
Case vbNo
DoCmd.Requery
End Select
End If
End Sub
Any help is greatly appreciated!
Regards,
Kerry