Check Child Records if check box selected (1 Viewer)

scottrie2

Registered User.
Local time
Yesterday, 23:40
Joined
Dec 27, 2018
Messages
15
I have a table of people (subscribers table - primary key subscriberID). Each subscriber can have multiple addresses (address table - Primary Key AddID and foriegn key SubID). I want to note which address I should ship a book to in the month of May each year, so in the address table there is a Order check box. Now all of this is on a form with my address information being on a subform. My problem is that I don't want 2 addresses to have the order check box checked. If I have the box checked for address 1 and the user checks the order box on address 3, I want the check on address 1 to be removed. The main form is called: frmSubscriber, the Subform is called Address and the check box is called chkOrder. I assume I am going to put some type of code on the chkOrder_AfterUpdate event but I am not sure what the code should be.:banghead:
 

June7

AWF VIP
Local time
Yesterday, 19:40
Joined
Mar 9, 2014
Messages
5,465
Something like:

CurrentDb.Execute "UPDATE Addresses SET chkOrder = False WHERE SubscriberID=" & Me.SubscriberID & " AND AddressID <> " & Me.AddressID
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 20:40
Joined
Oct 29, 2018
Messages
21,453
Hi. I just thought of something as another approach although I haven't really seen it used before, and that is, how about adding an OrderAddressID foreign key field in the Subscriber table to indicate which address is the shipping address? Just a thought...
 

Users who are viewing this thread

Top Bottom