Checking to see if record exists (1 Viewer)

ChampionDuy

Registered User.
Local time
Today, 13:10
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
 

Jack Cowley

Registered User.
Local time
Today, 13:10
Joined
Aug 7, 2000
Messages
2,639
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
 

ChampionDuy

Registered User.
Local time
Today, 13:10
Joined
Mar 14, 2002
Messages
94
Thank you very much worked great.
 

Users who are viewing this thread

Top Bottom