Solved

AccessCommand Button to cancel an Add New Record

Posted on 2007-04-07
5
253 Views
Last Modified: 2008-02-01
Is there an AccessCommand Button to cancel an Add New Record?
0
Comment
Question by:ksilvoso
  • 2
  • 2
5 Comments
 
LVL 34

Expert Comment

by:jefftwilley
ID: 18869962
the DoCmd.GoToRecord , , acFirst
will take you back to the first record
0
 
LVL 34

Expert Comment

by:jefftwilley
ID: 18869966
once you go to the new record...are you trying to cancel IF they have already entered something into the new record?
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 250 total points
ID: 18869994

if data have been entered  but not yet saved

Private Sub cmdCancel_Click()
     If Me.Dirty Then Me.Undo
End Sub
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 18869998
you can also close the form with

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

Author Comment

by:ksilvoso
ID: 18870464
Worked great.  Thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now