PC Review


Reply
Thread Tools Rate Thread

Cancel Button in User Form does not rever to original state

 
 
perficae@gmail.com
Guest
Posts: n/a
 
      18th Feb 2007
I have a User Form with five check boxes. The default setting for the
check boxes is FALSE.

When I open the user form and select some of them and then hit the
CANCEL commandbutton (the idea being that I dont want to make any
changes afterall), the cells chosen as the ControlSoruce retain the
TRUE value.

What I want it to do is for it to return to the state the check boxes
had when the User Form was open - whether that be TRUE or FALSE.
While the default state is false, in some cases selections may have
been made previously.

The code associated to the Cancel Button is:

Private Sub cb_Cancel_Click()

Unload Me

End Sub

I thought that this was the code to use to achieve cancel any actions
taken on a user form. Obviously not.

What do I need to do?

Thank you.

 
Reply With Quote
 
 
 
 
Tom Ogilvy
Guest
Posts: n/a
 
      18th Feb 2007
No, it just fires the event you program to take the actions you want.

So in the Initialize event, gather the values in the cells and store them in
a module level variable(s). In the cancel event, restore those values by
writing them back to the cells (or work with the checkboxes - your choice.

--
Regards,
Tom Ogilvy


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have a User Form with five check boxes. The default setting for the
> check boxes is FALSE.
>
> When I open the user form and select some of them and then hit the
> CANCEL commandbutton (the idea being that I dont want to make any
> changes afterall), the cells chosen as the ControlSoruce retain the
> TRUE value.
>
> What I want it to do is for it to return to the state the check boxes
> had when the User Form was open - whether that be TRUE or FALSE.
> While the default state is false, in some cases selections may have
> been made previously.
>
> The code associated to the Cancel Button is:
>
> Private Sub cb_Cancel_Click()
>
> Unload Me
>
> End Sub
>
> I thought that this was the code to use to achieve cancel any actions
> taken on a user form. Obviously not.
>
> What do I need to do?
>
> Thank you.
>



 
Reply With Quote
 
hdf
Guest
Posts: n/a
 
      18th Feb 2007
Thank you. I know exactly what to do now.


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      18th Feb 2007
Another option would be to drop the controlsource and just pick up the values in
the initialize procedure.

And write the new values in the "Ok" button procedure.



(E-Mail Removed) wrote:
>
> I have a User Form with five check boxes. The default setting for the
> check boxes is FALSE.
>
> When I open the user form and select some of them and then hit the
> CANCEL commandbutton (the idea being that I dont want to make any
> changes afterall), the cells chosen as the ControlSoruce retain the
> TRUE value.
>
> What I want it to do is for it to return to the state the check boxes
> had when the User Form was open - whether that be TRUE or FALSE.
> While the default state is false, in some cases selections may have
> been made previously.
>
> The code associated to the Cancel Button is:
>
> Private Sub cb_Cancel_Click()
>
> Unload Me
>
> End Sub
>
> I thought that this was the code to use to achieve cancel any actions
> taken on a user form. Obviously not.
>
> What do I need to do?
>
> Thank you.


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cancel button in a form BCiel Microsoft Access Form Coding 5 29th Sep 2008 05:04 PM
Cancel Anticipated User Button Pushing =?Utf-8?B?TUJvb3plcg==?= Microsoft Access Form Coding 5 30th Nov 2005 07:35 AM
restore default user profile to original state =?Utf-8?B?Y2hpZWtv?= Microsoft Windows 2000 3 31st Oct 2005 03:03 PM
reset a toggle button to its original state after being clicked =?Utf-8?B?cG9sbmljaGVr?= Microsoft Access 2 15th Jul 2005 09:05 PM
Custom button from a Control class doesn't appear as a choice for OK/Cancel button in a Form properties CroDude Microsoft C# .NET 3 28th Jun 2005 06:27 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:41 AM.