Check all checkboxes

miiia83

Registered User.
Local time
Today, 09:01
Joined
Feb 23, 2007
Messages
12
I have a form that I use to register hours for different projects. The form has fields to fill in new data, and a subform that shows records that already exists for the chosen project. I need a button (or similar) that I can click that checks all the checkboxes for the chosen project ID I'm working on, to register them as "completed". I have a column named Passive (Yes/No) for that. Any idea how to make this happen so I don't have to click them one by one? Keep in mind that I'm not a programmer.
 
I thinks it Looks like you will have to dip you toe into programming!
You need to create a button and on the click event set the states for the check boxes to true.
For example
Sub button1_click()
me.checkbox1 = true
me.checkbox2 = true
....
end sub
If the check boxes are on the subform then you would have to refer to that.
Its hard to be more specific with the information that you have given.

Good luck! :-)

Tim
 
It's tricky to explain when i don't know the correct names. It's not a separate checkbox. It's a table with column named Passive with datatype Yes/No. Looks like a checkbox, but maybe it's called something else in a table.
 
The table/column Passive with Yes/No shows as a checkbox in the form.
I am guessing that you need to generate a yes over multiple records that correspond to the project that you are working on.
 
The datatype Yes/No is a checkbox. If you take a look at the form in design view then you will be able to check what the names of the checkboxes are on the form... how many checkboxes are there? If there are quite a lot then I would suggest looping through an array (sounds scary but I can try and help if you need...)
 
The datatype Yes/No is a checkbox. If you take a look at the form in design view then you will be able to check what the names of the checkboxes are on the form... how many checkboxes are there? If there are quite a lot then I would suggest looping through an array (sounds scary but I can try and help if you need...)

In design view there's of course only one checkbox, but in normal view there can be quite many records. I attached two picture that might help, one is design view.
 

Attachments

  • 21.9.png
    21.9.png
    28.8 KB · Views: 737
  • Design view.png
    Design view.png
    24.8 KB · Views: 718
It looks as though from the pictures you are using a Continuous form is that correct?
 
I had to google continuous form, but yes that's what I have :)
 
Then I think you may have to loop through the recordset to tick each checkbox - its difficult to say without seeing how it works. Perhaps you could look into looping through recordsets and see if that gets you closer...
 
That sounds easy enough but how do I refer to the subform? Sorry but I am new to this. Your efforts are appreciated.
 
No need to use a recordset or loop. Just create an Update query and run it when you need them updated.

UPDATE TableNameHere SET [Passive] = True
WHERE ID=[Forms]![FormNameHere]![ID]
 
No need to use a recordset or loop. Just create an Update query and run it when you need them updated.

UPDATE TableNameHere SET [Passive] = True
WHERE ID=[Forms]![FormNameHere]![ID]

It seems to find the records with the right ID, but it doesn't check the checkboxes (make them true/yes).
 
Thanks but I just can't get it to work.
I have a form with a subform called frmPCVouchers. The subform is derived from a query to select all Vouchers not reconciled. There is a button on the main form and when it is clicked on I want the field PCisReconciled to be updated to True. The table that holds the info is tblPCVouchers.

Thanks
 
You didn't say which field is the ID field that the subform is linked to on the parent (main) form. So, something like this:

Update tblPCVouchers Set PCisReconciled = True Where [YourIDFieldNamehere]=[Forms]![YourMainFormNameHere]![YourControlNameHereThatIsBoundTotheIDField]
 
Thanks Bob,

I will try it tomorrow (don't have my work computer with me at the moment). It kept getting stuck on the SET but maybe I was typing something silly.

Regards

Farmer
 
Not sure what I did differently today, but today it works! Thanks for your help!
 
Thanks,

I think my main problem is that I have a form derived from a query as the subform but it won't allow me to make it a child. When I set up the master child link it thinks that the ID of the master is a filter and I lose my records.

(Sorry so long before replying but ended up having to travel this week.
 

Users who are viewing this thread

Back
Top Bottom