Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Sep 2007
    Location
    Chatham, Kent, England
    Posts
    214
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DoCmd.Save (Access 97)

    Hello everybody

    In an attempt to automatically save records after an update I have coded 'DoCmd.Save' into a form's 'lost focus' and then 'after update' event procedures.

    Both these two options produce quirky results!

    Where, traditionally, does the save command go on a form in order to give the user user frendliness?

    Regards

    Graeme

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: DoCmd.Save (Access 97)

    Hello Graeme,

    There is no need to save a record in a bound form. Access will save a record automatically when the user moves to another record or closes the form. You should teach your users that Access works this way - it is a frequent source of confusion.

    However, if you want to save a record explicitly, you must use RunCommand acCmdSaveRecord. This can be useful if you open a popup form or a report that uses data from the same table(s).

    The instruction you used, DoCmd.Save, does not save a record, but the design of the form; in a multi-user environment, this is undesirable and a cause of database corruption. Moreover, if you ever want to convert the database to Access 2000 or higher, you'll run into trouble, because in those versions the design of database objects can't be saved if more than one user is active - changing the design requires that you open the database for exclusive use.

  3. #3
    2 Star Lounger
    Join Date
    Sep 2007
    Location
    Chatham, Kent, England
    Posts
    214
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DoCmd.Save (Access 97)

    Once again, thank you very much!

    The form lists our customers. A subform lists a summary of all the addresses for the displayed customer. A button on the sub form opens an address details form for the displayed address. So when information is entered on the address summary form, the record must be saved before the address details form is opened or the information will not be displayed.

    I put 'RunCommand acCmdSaveRecord' into the 'On Deactivate' event procedure on the address summary form and the thing now works a treat!

    Bye for now

    Graeme

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •