A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Multiple Field Restriction



 
 
Thread Tools Display Modes
  #1  
Old September 17th, 2008, 06:29 PM posted to microsoft.public.access.tablesdbdesign
FerryMary
external usenet poster
 
Posts: 4
Default 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  
Old September 18th, 2008, 02:45 PM posted to microsoft.public.access.tablesdbdesign
Golfinray
external usenet poster
 
Posts: 1,597
Default 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  
Old September 18th, 2008, 02:50 PM posted to microsoft.public.access.tablesdbdesign
TedMi
external usenet poster
 
Posts: 507
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:58 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.