Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving changes 1

Status
Not open for further replies.

Cmakal

Technical User
Aug 1, 2000
1
US
I'm a relatively new user of Access.  I was wondering if there was anyway to make it so that users are queried whether to save changes on records within Tables, Queries, and Forms.  The main problem we have is when the person accidentally exits the application and the information is then saved.  This mistaken data is then used by others, and it causes many problems.  Does anyone know how I can alleviate this problem?
 
Unfortunately, the changes and additions are immediately written to the table (if you are entering or changing data in a table or query).<br><br>For forms, if they are bound, you have to put a promp on the BeforeUpdate of the form and if the user says no, then use the cancel = true. OR use the undo record action if it is a new record.<br><br>If your forms are unbound, then you can simply prompt them. If they say they want to save, write it to the table, if they say no, close the form.<br><br>If you want to prompt the user every time they make a change or addition to whether or not they want to save, then use unbound forms, and write the data to the tables with DAO. The coding takes a little longer, but it is easier to control from a developers point of view.<br><br>Just my opinion, take it for what it's worth. <p>Jim Lunde<br><a href=mailto:compugeeks@hotmail.com>compugeeks@hotmail.com</a><br><a href= Application Development
 
ok, i haven't thought this all the way through.&nbsp;&nbsp;but what you could do is create a &quot;dummy&quot; form that is not bound to anything that the user sees - this would be just like the one that you have now.<br>then you could so what Jim suggests by prompting after every record to add it to the form.&nbsp;&nbsp;the code would look something like this (credit to DougP i believe).<br><b><br>Dim db As Database, rst, rst2, rst3 As Recordset<br>Set db = CurrentDb<br><br>Set rst = db.OpenRecordset(&quot;<font color=red>MyTable</font>&quot;)<br>Set rst2 = db.OpenRecordset(&quot;<font color=red>MyTable2</font>&quot;)<br>Set rst3 = db.OpenRecordset(&quot;<font color=red>MyTable3</font>&quot;)<br><br>rst.AddNew<br>rst.Fields(&quot;<font color=red>MyField</font>&quot;)= Me!<font color=red>Text1</font><br>rst.Fields(&quot;<font color=red>MyField2</font>&quot;)= Me!<font color=red>Text2</font><br>rst.Update<br><br>rst2.AddNew<br>rst2.Fields(&quot;<font color=red>MyField</font>&quot;)= Me!<font color=red>Text1</font><br>rst2.Fields(&quot;MyField2</font>&quot;)= Me!<font color=red>Text2</font><br>rst2.Update<br><br>rst3.AddNew<br>rst3.Fields(&quot;<font color=red>MyField</font>&quot;)= Me!<font color=red>Text1</font><br>rst3.Fields(&quot;<font color=red>MyField2</font>&quot;)= Me!<font color=red>Text2</font><br>rst3.Update<br><br>rst.Close<br>rst2.Close<br>rst3.Close<br>db.Close<br></b><br><br>simply change the red to your names.<br><br>or you could have the form bound to a &quot;dummy&quot; table, that once the user was done entering all records they would be prompted(on close of the form) if they wanted to save the records.&nbsp;&nbsp;this in turn would first run an append query to add these records to the &quot;real&quot; table, and secondly would run a delete query to remove them from the dummy table. <p>Brian Famous<br><a href=mailto:bfamous@ncdoi.net>bfamous@ncdoi.net</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top