2 Questions: Create Error Pop-Up

J

Jeff

Q1: Below is the code for a pop-up where the user inputs
an ID to open a form to a specific record. How do I
create an error pop-up for invalid ID input where the ID
is not detailed on the table?

I'm pretty sure that my answer is to set the Validation
Rule and Text properties, but I can't figure out how to
complete the DLookup expression:

DLookup («expr», «domain», «criteria»)

Private Sub FindCustID2_Click()
On Error GoTo Err_FindCustID2_Click

Dim stDocName1 As String
Dim stLinkCriteria As String

stDocName = "CustDetailsTableInputFormUPDATE"

stLinkCriteria = "[CUST ID]=" & Me![Text3]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Maximize
DoCmd.Close acForm, "Switchboard"
DoCmd.Close acForm, "FindCustID"

Exit_FindCustID2_Click:
Exit Sub

Err_FindCustID2_Click:
MsgBox Err.Description

End Sub

Q2: I was able to set the input mask to !00000000.0;0;" "
to insure the correct input type, although I am not crazy
about the error message for invalid value input as follows:

"The value you entered isn't appropriate for the input
mask !00000000.0;0;" " specified for this field."

Can I change this to a custom message reading
simply "Invalid Format"?

Thank you in advance for your assistance!!!
Jeff
 
Top