Whilst still much preferring the combo approach if feasible, here is a modified version of my previous code including criteria as Paul correctly pointed out were needed
The parameters for filtering the form are only supplied after the check has been done
The following code assumes a field name 'Company', table name tblClients and the ClientNumber is the number value entered in textbox txtClient
Code:
If Nz(DLookup("Company", "tblClients", "ClientNumber=" & Me.txtClient), "") = "" Then
MsgBox "This client does not exist"
Exit Sub
Else
DoCmd.OpenForm "frmClientInfo", , ,"ClientNumber=" & Me.txtClient
End If
If the ClientNumber is a text field, instead use text delimiters
Code:
If Nz(DLookup("Company", "tblClients", "ClientNumber='" & Me.txtClient & "'"), "") = "" Then
MsgBox "This client does not exist"
Exit Sub
Else
DoCmd.OpenForm "frmClientInfo", , ,"ClientNumber='" & Me.txtClient & "'"
End If