Values matching or authentication

  • Thread starter Thread starter Wasim Yasin via AccessMonster.com
  • Start date Start date
W

Wasim Yasin via AccessMonster.com

I have a table name 'MasterTable'. when a user inputs data in a field on
the form , at this stage i want the values be entered first match with
master table field. If match then proceed on next field otherwise display a
message.For this purpose I need code of event procedure.
 
Wasim,
Use the BeforeUpdate event of the field to determine if that value exists
in MasterTable.
Lets say the text control is a key field such as... CustomerID, and your
trying to make sure that there is a CustomerID in MasterTable before
proceeding to the next field...

If IsNull(DLookup("[CustomerID]", "MasterTable", "CustomerID =
Forms!YourFormName!CustomerID") Then
MsgBox "ID doesn't exist. Please try again.", vbOKOnly, "No record
Found"
CustomerID.Undo
Cancel = True
End if
hth
Al Camp
 
Back
Top