Select all Check box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that contains 25 fields that are unbounded check boxes. I
created another unbounded check box, "Select all" Below is the code I set up
for it to select all. Two problems. First is that "Painting" will not select
with this function. I Have the name spelled correctly in properties. It will
check on its own. Second problem. Once the "Select All" is checked and all
boxes get checked,(except Painting), it will not unselect, but instead
freezes up. Any thoughts would be appreciated. Thanks you.
Jason

Private Sub Select_All_AfterUpdate()
Me.Airstairs_Entrance = Me.Select_All
Me.Carpet = Me.Select_All
Me.Cockpit_Items = Me.Select_All
Me.Complete_Refurbishment = Me.Select_All
Me.Cup_Holders = Me.Select_All
Me.Curtain = Me.Select_All
Me.Divan = Me.Select_All
Me.Dye_Job = Me.Select_All
Me.Entertainment = Me.Select_All
Me.Galley = Me.Select_All
Me.Headliner = Me.Select_All
Me.Lavatory = Me.Select_All
Me.Lighting = Me.Select_All
Me.Loncoin = Me.Select_All
Me.Lower_Side_Walls = Me.Select_All
Me.Repair = Me.Select_All
Me.Runner = Me.Select_All
Me.Seat_Belts = Me.Select_All
Me.Seats = Me.Select_All
Me.Table = Me.Select_All
Me.Telephone = Me.Select_All
Me.Various_Miscellaneous = Me.Select_All
Me.Veneer = Me.Select_All
Me.Windowline = Me.Select_All
Me.Painting = Me.Select_All

End Sub
 
Forms have a built-in property named 'Painting' so using that word as a
control name is probably not a good idea.

If you want to check/uncheck all check boxes on the form except the one
named 'SelectAll', you can do it much more concisely like so ...

Private Sub SelectAll_AfterUpdate()

Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acCheckBox And _
ctl.Name <> "SelectAll" Then
ctl.Value = Me.SelectAll.Value
End If
Next ctl

End Sub
 
I changed the Painting field to "Paint Jobs", that fixed the first problem.
Now a dialog box appears when I click my "OK Button asking me to enter my
parameter value. I is attached to the "Select all" check box. I feel that the
code you wrote in the prior message will prevent the form from trying to use
the select all check box as a parameter. What do I need to change in your
code to make it work for my application. Do I need to type a line for every
field? Not sure where to go from here. Thanks for your help up to this point.
 
Aviator said:
I changed the Painting field to "Paint Jobs", that fixed the first
problem. Now a dialog box appears when I click my "OK Button asking
me to enter my parameter value. I is attached to the "Select all"
check box. I feel that the code you wrote in the prior message will
prevent the form from trying to use the select all check box as a
parameter. What do I need to change in your code to make it work for
my application. Do I need to type a line for every field? Not sure
where to go from here. Thanks for your help up to this point.

What is the code behind your "OK" button? It doesn't sound like this
second issue has anything to do with the first. What is this button
supposed to do?
 
I have abandoned the select all box. I created a seperate form that handled
my needs. Thank you for the interest though.
 
Back
Top