Checking to see if record exists

ChampionDuy

Registered User.
Local time
Today, 15:02
Joined
Mar 14, 2002
Messages
94
I would like to type in a ID number and check to see if it exists in the database. If it does I would like to display another form that shows the rest of the information relating to that specific ID number. If it does not exist I would like a message box to pop up and let the user know that he or she's id number does not exist. I am using Access 2000
 
Put code similar to this in the After Update event of the ID field:

If Not IsNull(DLookup("[IDFieldName]', "TableName", "[IDFieldName' = " & Me![FieldOnFormWithID]) Then
MsgBox "ID exists"
DoCmd.OpenForm "FormName", , ,"[ID] = " & Me![FieldOnFormWithID])
else
MsgBox "ID doesn't exist"
End if
 
Thank you very much worked great.
 

Users who are viewing this thread

Back
Top Bottom