Multiple Field Restriction

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.
 
G

Golfinray

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.
 
T

tedmi

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top