Solved

AccessCommand Button to cancel an Add New Record

Posted on 2007-04-07
5
252 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
Comment Utility
the DoCmd.GoToRecord , , acFirst
will take you back to the first record
0
 
LVL 34

Expert Comment

by:jefftwilley
Comment Utility
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
Comment Utility

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
Comment Utility
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
Comment Utility
Worked great.  Thanks!
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 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

12 Experts available now in Live!

Get 1:1 Help Now