HOW TO CLEAR CHEK BOXES AUTOMATICALLY

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

Guest

I WANT THAT WHEN THE FORM LOADS ALL THE CHECK BOXES SHOULD GET CLEARED.
PLEASE HELP
 
Use the form's Load event:

Private Form_Load()
Me.CheckBoxName1.Value = False
Me.CheckBoxName2.Value = False
' continue for all eheckbox controls
End Sub
 
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.
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top