If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Multiple Field Restriction
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. |
#2
|
|||
|
|||
Multiple Field Restriction
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. "FerryMary" wrote: 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. |
#3
|
|||
|
|||
Multiple Field Restriction
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. -- TedMi "FerryMary" wrote: 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. |
Thread Tools | |
Display Modes | |
|
|