duplicate records!

student90210

New member
Local time
Yesterday, 18:14
Joined
Apr 30, 2006
Messages
8
I have a form in Access which has event date and then also an event time slot such as "Morning, Afternoon, Evening" . I need to make it so that you cannot have a duplicate time booking, i assume i will need to code some VBA but if anyone could tell me what it would be much appreciated. Thanks
 
In your table structure for the table you are drawing the data from you would set the two fields you require as the composite Primary Key. The combination of the two fields will not allow duplicates.

eg., the fields are named: edate, etime
you could set it so the PK is a combination of edate & etime.
Therefore you could enter the following and it would be fine:
10/05/2006 Morning
10/05/2006 Evening
11/05/2006 Morning
12/05/2006 Afternoon
13/05/2006 Morning
13/05/2006 Afternoon
13/05/2006 Evening

Then if somebody tried to create a new record with the combination 13/05/2006 & Afternoon they would be unable to. If they tried to create 12/05/2006 and Evening they would be allowed.
 
duplicate data

thanks, I set the event date and time slot to be composite keys, but now i cannot enter any data in the form that would be stored in those tables. Thanks again
 

Users who are viewing this thread

Back
Top Bottom