Phucon-
Why is the form unbound? If you were to bind it to the table in which you are saving the data, you could let Access do all the work.
But if you want to keep the form unbound, you could add code to the code behind your "Close" button to detect whether there is data to be saved. You could also use the form's Close or Unload events to detect when the form is closing. In the Unload event, you can also set Cancel = True if you do not want the form to close because it has unsaved data.
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)
-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of saigonf7q5@yahoo.com
Sent: Friday, August 30, 2013 2:42 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] How to check if data's been entered (or if it's dirty) in an unbound form
I have an unbound data entry form. The form has a Save and a Close button. After the data was entered, and if the user close the form without clicking the Save button, the data is lost. I am trying to build something which can prevent that happens. What I have in mind is to loop through the controls, text boxes… for example. If the control is not null then spit out a message to inform the user… Will that work? Or what are the better alternatives? Thank you Phucon p.s. I was having trouble in posting messages. Yahoo returned my last post with delivery failure, hopefully it will be ok this time.
------------------------------------
Yahoo! Groups Links
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (2) |
Tidak ada komentar:
Posting Komentar