Save a record when switching between forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an Access 2007 application that needs to resemble a LOTUS Approach
implementation of the application.

I have been able to reproduce most of the look and feel of the Approach DB
app except for the following.

If a user enters or modifies data on a tabbed form, switches to another
tabbed form, enters or modifies data on the second form (both forms are based
on the same query) and then tries to go back to the first form a record
locked by another user dialog is displayed.

If the user presses the save button on the ribbon before leaving the forms
no error occurs.

I tried to automate the pressing the save button by using SendyKeys
"+({ENTER})", Wait to send a Shift+Enter in the On Deactivate event but it
doesn't fix the problem.

Any ideas.
 
If the user presses the save button on the ribbon before leaving the forms
no error occurs.

I tried to automate the pressing the save button by using SendyKeys
"+({ENTER})", Wait to send a Shift+Enter in the On Deactivate event but it
doesn't fix the problem.

Instead of a (VERY buggy and unreliable) Sendkeys, use either

DoCmd.RunCommand acCmdSaveRecord

or

If Me.Dirty Then Me.Dirty = False

in your code to force a record save.

Put this code in the click event of the button, before the OpenForm event, not
in the Deactivate event.


John W. Vinson [MVP]
 
Back
Top