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. 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. (I'm assuming your situation was that once the user tabbed past the last field the record was saved by default). 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
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.