Link to home
Start Free TrialLog in
Avatar of jjc9809
jjc9809

asked on

Access 2007 Verification Question on database tables

I have attached a database that contains three Tables and three Data Entry Forms for the tables.  The Tables Are;  Point of Interest, Vehicles, and Weapons.  I need the capability to verify if a Driver License Number exists in the Point of Inrterest Table if the Driver License Number is entered in the Vehicle or Weapon Table.  I want an error message to appear when a user tries to enter a Driver License Number on the Vehicle or weapon table in the Driver License TextBox field.  If the Driver License Number exists allow the saveing of the record.  If the Driver License Number does not exist I want a mesage that one has entered a Driver License Number that does not exist.  How can this be done with VBA in ACcess and what property area should the coding be put on a form.  Should the arae be on an after update event or on a On-Click event?

I have attached a sample database I created from scratch real quickly.  CFould you maybe show me some coding how this can be done in VBA?

Thanks

jjc9809
Database2.accdb
ASKER CERTIFIED SOLUTION
Avatar of pdebaets
pdebaets
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jjc9809
jjc9809

ASKER

I ca't get this to work.  See my attachments where I placed the code ad tried to run it.  See if you can get it to work.

jjc9809
RunCode.jpg
CODE-DEBUG.jpg
Avatar of jjc9809

ASKER

Pdebaets,
 
I found my problem.  I used an incorrect name in the coding for PointOfInterest Table.  I renamed the table and removed the space in PointOfInterest.  I named the table PointOf Interest as the tablename but failed to indicate the space there so the computer was unable to find the table.

Thanks

This works.