Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / October 2007

Tip: Looking for answers? Try searching our database.

Save a record when switching between forms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JimW - 04 Oct 2007 21:29 GMT
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.
Signature

Thanks in advance for your help.

Jim

John W. Vinson - 04 Oct 2007 22:56 GMT
>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]
JimW - 04 Oct 2007 23:25 GMT
Thanks John!!

The DoCmd.RunCommand acCmdSaveRecord syntax did the job!

Jim

> >If the user presses the save button on the ribbon before leaving the forms
> >no error occurs.
[quoted text clipped - 17 lines]
>
>              John W. Vinson [MVP]
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.