Reset value to False in Checkbox when closing form

N

nlandsnes

I have a split form with a Checkbox called "Select" it's default value is
False (0)
when I close the form I want the field value (if changed) to be reset to
False (0).
In my form I have an event procedure under On Close:

Private Sub Form_Close()
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acCheckBox Then
ctl.Value = False
End If
Next
End Sub

When I close the form I get an error message: Run-time error 2448 "You can't
assign a value to this object."
Any ideas where I've gone wrong?
 
J

Jeanette Cunningham

The close event is too late for what you want to do. To make changes to
unbound controls, use the Unload event of the form.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

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