Refresh Checkbox

G

Guest

Hello Group,

I'm trying to create a button that can uncheck all checkbox in my form when
I click on it.

Thanks
 
R

Rick B

Ok. Create the button and then in the 'click' event put code such as...


Private Sub SomeButton_Click()
SomeField1 = 0
SomeField2 = 0
SomeField3 = 0
End Sub



Rick B
 
G

Guest

Antonio,

In design view add a command button to your form and call it
cmdClearCheckBoxes (or something similarly descriptive). Then add the
following code to an [Event Procedure] in the On Click event of the control.

Private Sub cmdClearCheckBoxes_Click()
Dim ctl As Control
Dim frm As Form
Set frm = Me
For Each ctl In frm.Controls
With ctl
If .ControlType = acCheckBox Then
If ctl.Value = True Then
ctl.Value = False
End If
End If
End With
Next ctl

End Sub

When you click the command button the code will loop through all the
controls on your form. For each control it finds that is a check box it
will change the value of any selected check box to false . That should do
the trick for you.

Good luck,

Ken
 
G

Guest

Ken,

The code only uncheck the data I'm on not the entire data on a continue form

Thanks, is there something that i'm over looking


Ken Warthen said:
Antonio,

In design view add a command button to your form and call it
cmdClearCheckBoxes (or something similarly descriptive). Then add the
following code to an [Event Procedure] in the On Click event of the control.

Private Sub cmdClearCheckBoxes_Click()
Dim ctl As Control
Dim frm As Form
Set frm = Me
For Each ctl In frm.Controls
With ctl
If .ControlType = acCheckBox Then
If ctl.Value = True Then
ctl.Value = False
End If
End If
End With
Next ctl

End Sub

When you click the command button the code will loop through all the
controls on your form. For each control it finds that is a check box it
will change the value of any selected check box to false . That should do
the trick for you.

Good luck,

Ken

Antonio said:
Hello Group,

I'm trying to create a button that can uncheck all checkbox in my form when
I click on it.

Thanks
 

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

Top