Solved

don't save record and Close form

Posted on 2014-12-12
5
289 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
[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
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 48

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
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.
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…
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…

724 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