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!

Updating a table only after a record is saved in a form

Status
Not open for further replies.

CLC

Technical User
Apr 13, 2000
1
AU
I have a form linked to records in a table. When I change a field in the form the table is automatically updated (Access does this by default). Does anyone know of a way to update the table ONLY after a save button is clicked?<br><br>Thanks in advance.
 
Use the BeforeUpdate event; Declare a public variable (or use a hidden field on your form if you prefer) that is set to false when you wan't the form to be updated and to true when not. Then set Cancel=YourVariable in the BeforeUpdate event. If you wan't to force the record to be saved include DoCmd.RunCommand acCmdSaveRecord in your button_click event (otherwise the record is updated when you close the form or move to another record). Be sure to check that YourVariable always is set to false when you open the form or move to another record).<br><br>Regards,<br>Mats
 
CLC,<br>Alternatively, a less complex way would be to set the Cycle Property to Current Record.&nbsp;&nbsp;Now if you look at the 'record selector' (the grey bar on the left edge of the form), the little pencil will stay in that after the user tabs past the last field.&nbsp;&nbsp;(I'm assuming your situation was that once the user tabbed past the last field the record was saved by default).&nbsp;&nbsp;Anyway, as long as you see the pencil, the table is not updated, and depending on your Locking mode (see the Record Locks property on the form), the record may be locked, until you click the grey bar, or as mats suggested, click a button with a SaveRecord command.<br>--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top