Yes No Primary Key

aqif

Registered User.
Local time
Today, 19:45
Joined
Jul 9, 2001
Messages
158
Hi :)

I have got a table of doctors and one table of Doctor Adresses with One to many relationship. In the doc addresses table one doctor can have many addresses. There is a Yes No field in Doctor addresses indicating Yes if that address is prefered address of not. What I want is that the user can only make one address as Yes and other as No as only one doctor address can be a preferred one. Is there any way to accomplish that in table design or possibly as form level?

Cheers
Aqif
 
Another idea to help you on your way:

Define a (after update?, not sure about this) event using DCount to count the number of Yes/No's set to "Yes" for the Doctor Adresses for a specific doctor.

If DCount > 1, a message pops up ("You can have only one preferred address").
You the line Cancel = True to wipe out the user action.
Use the line Me.Undo to undo the user action.

RV
 

Users who are viewing this thread

Back
Top Bottom