Allowing Duplicates

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that everyone enters data into. I have allowed the date field
to have duplicates because we all enter data in for the same days. My
question is can I put something in the code that will still allow the
duplicates for the date field but will have a limit of one a day per person?
In other words if 3 people enter data in for the same day, it's ok for that 3
dates to be the same but I want them to only be able to enter it once per
day, not allow duplicate records for the same person on the same date.

Thanks
 
If you're only storing date (and not date/time), you could create a unique
index (which is different than a primary key) that includes both the user
and date fields.
 
How would I do that?

Douglas J. Steele said:
If you're only storing date (and not date/time), you could create a unique
index (which is different than a primary key) that includes both the user
and date fields.
 
With the table open in Design mode, choose View | Indexes from the menu bar.
Type anything you want as the name of the index, type the name of the first
field in the Field Name column beside that, and choose a sort order (it's
not critical what order you pick). On the next row, leave the Index Name
blank, type the name of the second field in the Field Name column and pick a
sort order. In the bottom left-hand side of the dialog box, set Unique to
Yes.
 
Back
Top