Solved

don't save record and Close form

Posted on 2014-12-12
5
267 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 119

Accepted Solution

by:
Rey Obrero 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Query Missing Money orders... 6 73
Access 2010 3 19
Input box criteria 3 20
SharePoint 2013 Relational Database 8 27
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
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…
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 …
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now