Hi have following situation:
i have a text box (in a form) where you enter in your customer ID. The accompanying command button opens up another form based on the ID of the customer that has been entered. Everything works well until here.
However if the customer enters a non-valid ID which means an ID that is not in the Data base I want it to say "ID does not exist" before it opens up the form so zou can try again.
here is the code I have for the comand button:
Option Compare Database
Private Sub Command9_Click()
On Error GoTo Err_Command9_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Alternative Transportation Field Survey"
stLinkCriteria = "[Dealer Code]=" & Me![Text2]
DoCmd.OpenForm stDocName, , , stLinkCriteria
MsgBox "Please enter the data into the yellow marked fields and save before you close the survey"
MsgBox "Please enter Dealer ID"