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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving Forms 1

Status
Not open for further replies.

dlp

Programmer
Feb 14, 2000
2
AU
The controls in my forms are directly linked to the db table. The macro behind the close button is set to prompt to save, yet the prompt does not show, and changes seem to be saved automatically. I want the users to have the option to rollback from their changes.<br>
I know that I can save the recordset as multiple variables when moving through each record, and if there has been any changes when the user is moving to the next record the system can prompt the user to save these changes.<br>
The problem with this it can be a little annoying, is there anyway to save all the changes made while at a form all at once, hence the user is only asked whether or not to save once exiting the form.<br>
Otherwise- Is there any better method than reverting to recordsets and variables.<br>
<br>
Thanks!
 
Well, yes just have the form attached directly to the recordset. NO CODE at all.<br>
Which &quot;save&quot; are you using, it sounds like you are using the &quot;SAVE FORM&quot; which is NOT a save feature of a record. It saves the changes made to the form as though you are designing it. That's why it is not prompting you you have'nt made any changes to the form itself.<br>
Access is difficult to make save manually at best.<br>
It saves changes automatically by default. you have to write a lot of work arounds to do it your way.<br>
This is good in some case's but bad in others like your example.<br>
<br>
To save a record you can use this code<br>
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70<br>
in a button<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
If you use the wizard when you add a button to the form, you can choose &quot;Record Operations&quot;, &quot;Save Record&quot; for one button and &quot;Undo&quot; for a second button. Alternately you can use the Before Update event on the form to pop up a Save Record? messagebox. Looks like this:<br>
<br>
Private Sub Form_BeforeUpdate(Cancel As Integer)<br>
Dim response As Integer<br>
response = MsgBox(&quot;Save Record?&quot;, vbYesNo)<br>
If response = vbNo Then<br>
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70<br>
End If<br>
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top