Trying to put a checkbox or commandbutton on the parentform...and when either is activated will change the current state of all my checkboxes on a subform.datasheet to a true state! subform is the result of a query.
'in this example all check boxes have a sequential name...
'I.E. Check10, check11, check12...etc.
'the code toggles check values for the active form via a button click event.
Private Sub Command56_Click()
For intIndex = 10 To 16 Step 1
If Me.Controls("Check" & intIndex).Value = 0 Then
Me.Controls("Check" & intIndex).Value = 1
Else
Me.Controls("Check" & intIndex).Value = 0
End If
Next
End Sub
Thanks ETID, yes that code will work, but i fail to mention that checkboxes is a field in my table, record entered by my employees... so one, i wouldnt be able to name them individually,since they are generated when table is queried. i hope i am making sense. anyway, no way to tell access via commandbtn to check every boxes in this field and true when clicked?? and added note... cant use default true, because i use that step to indicate the record has been processed. trust me, if it was a matter of 10-20 checkboxes i wouldnt bother, as it is currently i am checking 100's boxes and desparately need to automate that.
'something like this in the click event of the button.
'substitute your table name in place of "my_table"
'and the checkbox field name in place of "target_field"
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE my_table SET my_table.target_field = 1 WHERE (((my_table.target_field)<> 1)); ", -1
DoCmd.SetWarnings True
GREAT!! thanks ETID...worked like a charm!! I hate to be greedy but since i am on a roll...:0)
now that i can automate the checkboxes...when i manually processed it i have a [udate] field populate with Now (current date) i can seem to get that code to work with my checkall command...under the docmd.runsql line i inserted if admin = true then udate = now ...nothing! got any idea?
i have tried that several different ways... i think it is not recognizing the checkbox [admin] as being true.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.