Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validate data in a field with data in another table

Status
Not open for further replies.

Lreader

Technical User
Jul 27, 2000
13
CA
I have to create an event procedure.I have a form with a control based on a field [account] from TableA
When an account number is entered in that field, I want Acces to check in a specific field in TableB if that number exist: if it doesn't I need a message box to indicate the warning!

I just begin with VBA code and I am unable to do that!

Thanks for help if it is possible!

 
If it were me, I would use a combo box or list box based on the table that lists the accounts. This would allow the user to select from existing accounts only. Michelle Fulton

 
Hello,
You can use the Dlookup() function to find on the TableB the number and the send de message box.

Their's the code

Dim Found as variant

Found=DLookup("[Filed from tableB]", "TableB", "[Criteria Field] =" & TextBox value)

if Found then
MsGbox("Record Existe")
End if

Is someting like this, tray found more info about the Dlookup Function on Acess Help.

Good luck.
Albano
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top