Validating data in 2 fields at same time

rgeoffb

New member
Local time
Yesterday, 20:57
Joined
Feb 9, 2004
Messages
5
I have a form that asks 2 questions. Date and Account. I need to check a table to see if the combination of both date and account have not been used. Date is normally today, can be yesterday. Account has a drop down menu with 6 choices. If both the date and account have been used then there should be an error shown to that effect. If not used, then proceed on to the next form for data entry.

Can this be done? And how?
 
If you want to ensure that only record has the same date and account then I would set both of those two fields as a primary key.

Your form will produce the runtime error # 3022 if the user tries to save the record but the date & account combination already exists and you can easily trap for that error and provide a custom message to alert the user.

You should avoid using reserved keywords like "date". That will cause problems.
 

Users who are viewing this thread

Back
Top Bottom