Solved

AccessCommand Button to cancel an Add New Record

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

617 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