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  

cancel button for form



 
 
Thread Tools Display Modes
  #1  
Old March 16th, 2005, 09:09 PM
robin
external usenet poster
 
Posts: n/a
Default cancel button for form

How do you program a cancel button so that the form does not file the
information in the table?
  #2  
Old March 16th, 2005, 09:19 PM
Jason
external usenet poster
 
Posts: n/a
Default

Set the button's cancel property to True and then place the following code in
the button's _Click procedu

Private Sub cmdCancel_Click()
If Me.Dirty Then
Me.Undo
End If
DoCmd.Close acForm, Me.Name

End Sub

"robin" wrote:

How do you program a cancel button so that the form does not file the
information in the table?

  #3  
Old March 16th, 2005, 09:21 PM
Wayne Morgan
external usenet poster
 
Posts: n/a
Default

First, you have a Cancel button preprogrammed for you. The Esc key does this
job. Educate the user that pressing Esc once undoes the current control and
pressing Esc a second time undoes the current record.

That said, the code you need behind a button is

Me.Undo

--
Wayne Morgan
MS Access MVP


"robin" wrote in message
...
How do you program a cancel button so that the form does not file the
information in the table?



  #4  
Old March 16th, 2005, 09:47 PM
robin
external usenet poster
 
Posts: n/a
Default

thanks, jason & wayne

"Wayne Morgan" wrote:

First, you have a Cancel button preprogrammed for you. The Esc key does this
job. Educate the user that pressing Esc once undoes the current control and
pressing Esc a second time undoes the current record.

That said, the code you need behind a button is

Me.Undo

--
Wayne Morgan
MS Access MVP


"robin" wrote in message
...
How do you program a cancel button so that the form does not file the
information in the table?




 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get a Toggle Button to work colin General Discussion 2 March 5th, 2005 12:51 AM
Give a botton on an Option Group Post Defualt Jan Il Using Forms 14 November 28th, 2004 05:21 AM
Open form, Edit button, etc Aniko Using Forms 14 July 25th, 2004 08:17 AM
Form Doesn't Go To New Record Steve New Users 15 May 16th, 2004 04:33 PM


All times are GMT +1. The time now is 12:59 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.