Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

AccessCommand Button to cancel an Add New Record

Posted on 2007-04-07
5
Medium Priority
?
260 Views
Last Modified: 2008-02-01
Is there an AccessCommand Button to cancel an Add New Record?
0
Comment
Question by:ksilvoso
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1000 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

722 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