?
Solved

Close Form Without Saving Record (Command Button)

Posted on 2003-03-02
4
Medium Priority
?
979 Views
Last Modified: 2007-12-19
I have a Command Button on a form which runs a macro with a single Close satement to close the form. However, if any data has been entered into any of the fields in the form before the button is clicked, the record is saved (even if it is incomplete). I want it to close the form without saving any of the data that has been entered. I know this is probably a fairly simple question, but the solution just escapes me!!!

Cheers,

Nick.
0
Comment
Question by:nharbour
[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
4 Comments
 

Accepted Solution

by:
wtf666 earned 300 total points
ID: 8053605
hey

use this code before closing the form , behind your exit command button ...

If Me.Dirty Then Me.Undo


this way if any thing will be written in your form it will not be saved unless u save it ...

also disable the close button of your form by right clicking the form and then setting the close button to OFF ..

hope this will work.
0
 
LVL 1

Expert Comment

by:jangeador
ID: 8053610
If the record is saving, chances are that it is complete by the table standards.  you could set the fields you need to be required in the table.
0
 
LVL 18

Expert Comment

by:1William
ID: 8876292
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept question, points to wtf666
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

1William
EE Cleanup Volunteer
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Suggested Courses

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