Multiple Field Restriction

  • Thread starter Thread starter FerryMary
  • Start date Start date
F

FerryMary

You lose it when you don't use it. Especially when you've been out of dbs
and swimming in spreadsheets for too long...

I need to limit records based on two fields. Here's scoop:

tblLeaveAccum
pk-leaveaccumid(autonumber)
empID-(number field)
Date

I want only 1 record per emplID and Date. I'm trying to not create
duplicate records when I run an update query.

Do I limit this in the table? ...or...
Would it be better to include the pk in the update query so I only update
applicable records?

Thanks-I feel as though I just answered my own question, but I'll defer to
the more experienced players in the room.
 
Try just running a Find Duplicates query (use the wizard) and locate your
dups first before you run the update. Then you can either filter them out or
delete them.
 
First remove any duplicate records that already exist (the query wizard can
build a find duplicates query). Then create a non-primary unique compound
index on the fields EmpID and Date. BTW, don't name your field "Date", as
that is a reserved word in Access and can cause unexpected and hard-to-trace
errors.
 
Back
Top