May 30 2005, 06:41 AM
On my form, I've got many check-boxes. I want to set up a reset button, and I usually list all commands within VBA individually to reset their values .
check0 = 0
check1 = 0
check2 = 0
and so on.
My question is : - is this the best way to reset, or is their a much more abbreviated way to reset the values of all check boxes on my form?
May 30 2005, 06:49 AM
Private Sub ResetCheckBoxes()
On Error GoTo ErrHandler
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acCheckBox Then ctl = False
On Error Resume Next
MsgBox ("Error No: " & Err.Number & vbCrLf & vbCrLf & Err.Description)
May 30 2005, 06:57 AM
Thankyou for the code sample.
Put that it in their, naturally works fine!
Appreciate your response. I take it where you have ACCheckbox, I would amend accordingly if I was looking to reset values of option buttons or other control types.?
May 30 2005, 07:26 AM
No worries. Check out 'ControlType' in the vb help file for a list of constants.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here