Update 1 column in a subform from a main form

grogmi1

Registered User.
Local time
Today, 02:42
Joined
Oct 26, 2012
Messages
56
Hello,

I am looking for a little more help with a database I am currently creating. I have a main form which contains a subform, both of these forms are controlled by a combo box which allows me to select records on the main form and displays the matching information in the subform.

I would like a command button on the main form to set all of the Yes/No boxes in the subform to False when clicked but only for the records selected by the combo box.

The main form is named: CarAdEntry_FRM
The Subform is a Datasheet named : ClearActive_FRM
The column in the subform which I would like to be cleared is Named : ActiveAD

Any help would be much appreciated
 
Create a query that selects all the records in your sub form filtered to the Parent PK field control on your main(Parent) form.
You can get the correct reference for that control by using the builder in the query designer.
Once you have this working change the query to an update query changing the value of your checkbox field.
Add a simple code to run the query to the button on your form.
 
Minty this is great, I have the query worjing thanks to you but how do I get the update query to run from the command button using code ? (Total novice!!)
 
There are a number of ways;
Beginner level - add a new button using the wizard and I think one of the options is to run a query.

Learning VBA - (And it's not hard) Create your cmdButton. On it's properties use the event builder on the On_Click Property. This will open the VBA Code window. Add some code to this along the lines of;

Code:
Private Sub cmdYourButton_Click()

  DoCmd.OpenQuery "MyQuery"

End Sub
Replace MyQuery with the name of your saved query.
 

Users who are viewing this thread

Back
Top Bottom