?
Solved

Close Form Without Saving Record (Command Button)

Posted on 2003-03-02
4
Medium Priority
?
984 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
3 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

601 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