Solved

don't save record and Close form

Posted on 2014-12-12
5
282 Views
Last Modified: 2014-12-12
Hello,

I have a form and if  the data entry person decides not to save the record and closes the form I would like to

Not save the record
close the form
clear any and all errors



I only have the close button (the X on the top of form) and no other buttons...they would click that button to close if they don't want to save the record
0
Comment
Question by:Ernest Grogg
5 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40496596
you need a command button to do this (cmdCancel)

private sub cmdCancel_click()

me.undo

docmd.close acform,me.name

end sub
0
 
LVL 26

Expert Comment

by:Nick67
ID: 40496611
Forget it.
While it is not impossible to do what you've asked, it is hard enough, and error prone enough, that you do not want to go there.  Good data entry forms are always a lot of work to create.  MS has created all sorts of nice wizards that create forms backed by live data  -- which create, change or alter data willy-nilly based on the actions of the user.  Not Good

Proper data entry forms have mechanisms that allow users to prepare their data for entry and that then require a deliberate action to make it so.  These are a lot more work to create than the simple wizard forms -- but getting good, clean data into the database is important enough to make it worth the trouble.

Maybe someone else will disagree.
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 40496823
I agree with Nick and Rey.

Although I leave the X and close options available on most of my forms, I disable those properties on my data entry forms and place Cancel and Save buttons in the form footer.  This way, the only way for a user to close a data entry form is to either cancel, or meet all of the requirements for saving the record.
0
 

Author Comment

by:Ernest Grogg
ID: 40496985
I agreed too put the button on the footer....thanks for the tip
0
 
LVL 26

Expert Comment

by:Nick67
ID: 40497013
Be warned.

There remain many ways for this to go wrong.
The app crashing
The computer rebooting/power failing/crashing
Network intermittency
Task manager use in killing the app.
Code that switches the focus to another app or form
Other things that don't come to the top of my mind at the moment.

The only certain way to ensure that only data you want entered into the tables is to do it through code yourself as the developer.  Everything else is prone to some level of -- perhaps acceptable in your application -- error
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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…

733 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