Solved

AccessCommand Button to cancel an Add New Record

Posted on 2007-04-07
5
255 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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

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…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

777 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