i'm having trouble comparing a form text box to the table to make sure the information entered was valid and should show a result. what i'm trying to do is have a form that has a text box that takes in a machine number and the user can open up certain information about the machine. The trouble i'm having is that if they enter in a machine number that is not there, i want a message box to pop up and tell them that no machine was found in the database. i haven't the slightest clue on how to write it. i've tried a bunch of different ways but to no avail. i have an error check if they don't enter a machine at all, though. This is my code for one of my buttons.
Private Sub cmdOpenPeriph_Click()
On Error GoTo Err_cmdOpenPeriph_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim x As String
If IsNull(Me![txtMach#]) Then
x = MsgBox("Please enter a Machine Number to look up.", vbOKOnly)
ElseIf Recordset = 0 Then
x = MsgBox("Please Enter a Valid Machine Identity", vbOKOnly)
stDocName = "PeripheralTable"
DoCmd.OpenForm stDocName, , , stLinkCriteria
the field name in the table would be "MACH#" and it is a text field. I need to compare this field with a text box field on a form that is unbound to make sure that what they entered actually exists in the table. the table name is just "ComputerInformation" where this field lies.