One to three relationship? (1 Viewer)

ForcedToUseIt

Registered User.
Local time
Today, 07:17
Joined
Jul 25, 2004
Messages
34
Hi all,

can you create a fixed one to three relationship between tables in Access 2007?

So far I have only seen one to many relationships...
 

Rabbie

Super Moderator
Local time
Today, 08:17
Joined
Jul 10, 2007
Messages
5,906
Hi all,

can you create a fixed one to three relationship between tables in Access 2007?

So far I have only seen one to many relationships...
Are you referring to a relationship between three tables ar to a special case of a one-to-many?

In the first case then you would need to use a junction table with fields for all three Keys. Otherwise its just a simple one to many link. You would need to have some validation code to check that you alwayds have just 3 child records.
 

neileg

AWF VIP
Local time
Today, 08:17
Joined
Dec 4, 2002
Messages
5,975
No. You can use code in a form to limit the number of records created but it's not standard functionality in Access.
 

ForcedToUseIt

Registered User.
Local time
Today, 07:17
Joined
Jul 25, 2004
Messages
34
No. You can use code in a form to limit the number of records created but it's not standard functionality in Access.

Thanks for the quick replies! Is sample code for this available somewhere?

Go Magpies!
 

neileg

AWF VIP
Local time
Today, 08:17
Joined
Dec 4, 2002
Messages
5,975
There's probably something in these forums if you do a search. Basically, I would use DCount() to count the number of occurrances of the key value in the secondary table. If it's 2 or less, create the record, if it's three or more, don't.
 

ForcedToUseIt

Registered User.
Local time
Today, 07:17
Joined
Jul 25, 2004
Messages
34
Yeah I did a search on this, found a similar piece of advice and it seems to be working fine.

Thanks for the help!
 

Users who are viewing this thread

Top Bottom