HOW TO CLEAR CHEK BOXES AUTOMATICALLY

K

Ken Snell \(MVP\)

Use the form's Load event:

Private Form_Load()
Me.CheckBoxName1.Value = False
Me.CheckBoxName2.Value = False
' continue for all eheckbox controls
End Sub
 
K

KIRIT

First of all let me thank you for your valuable help at the same time please
allow me to ask that can i continue it for the entire field using EOF or some
thing like that command. Point is that I have a table which contains a yes
/no field. Now i am allowing user to click check boxes depending upon his
query. However next time when he opens the form all these check boxes should
get cleared.







THANKS A LOT.
 
M

missinglinq via AccessMonster.com

Your explanation is somewhat muddy (can i continue it for the entire field
using EOF) but it still sounds as if Ken's code is correct. Another more
generic approach, which will loop thru the checkboxes and clear all of them
without having to use their actual names, would be:

Private Form_Load()

Dim ctrl As Control

For Each ctrl In Me.Controls
If TypeOf ctrl Is CheckBox Then
ctrl.Value = False
End If
Next

End Sub
 
T

tina

you haven't given a clear explanation of your setup; however, if you mean
that the checkbox(es) in the form are bound to field(s) in the underlying
table, and the form displays *multiple records*, and you want to clear the
checkbox(es) in *all the records* at the same time...then use an Update
query to set the value of the Yes/No field to False, in the table. suggest
you run this query *before* opening the form, otherwise you'll have to
requery the form's RecordSource to see the changed field values.

hth
 
Top