A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Reset value to False in Checkbox when closing form



 
 
Thread Tools Display Modes
  #1  
Old November 17th, 2009, 08:46 AM posted to microsoft.public.access.forms
nlandsnes
external usenet poster
 
Posts: 1
Default Reset value to False in Checkbox when closing form

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?
--
ndl
  #2  
Old November 17th, 2009, 10:22 AM posted to microsoft.public.access.forms
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default Reset value to False in Checkbox when closing form

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




"nlandsnes" wrote in message
...
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?
--
ndl



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:13 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.