Clearing all Check boxes then Checking One with 1 click of a button.

  • Thread starter Thread starter no.soliciting
  • Start date Start date
N

no.soliciting

I am not an access programmer and am not overly familiar with access,
however I can generally find my way around enough to accomplish what I
need...however, I'm stuck.

I have a form that has user information at the top, and at the bottom a
set of 5 forms in tab layout - behind each tab are anywhere from 5-20
checkboxes each with their own unique 8 character ID (ie. zzbas010).
Each checkbox is a "permission" that this person is being given. These
permissions change, so I need a way to open a user's record, click a
single button that will uncheck all of their current permissions (set
all checkboxes in the 5 forms to False) then check a single permission
(that everyone gets).

The final result will be a "clean slate" of permissions with the one
permission everyone gets already checked so it isn't forgotten by the
administrator when issuing new permissions.

I've tried a few techniques to no avail and would appreciate some help
if anyone is knowledgeable in this arena.
 
In the Click event of a command button, try code like:

Dim ctlCurr As Control

For Each ctlCurr In Me.Controls
If TypeOf ctlCurr Is Checkbox Then
ctlCurr = False
End If
Next ctlCurr

This assumes that there are no checkboxes on the form other than the ones
you want to uncheck.
 
You are fantastic - that is exactly what I needed. Thank you!

After clearing all the checks is there code that I can add that will
then check the zzbas010 checkbox (that's its ID zzbas010)?

I figured out how to have it checked by default when a new user is
added, but I also need that functionality if possible.

PS: Great resources on your page.
 
Back
Top