Results 1 to 4 of 4
  1. #1
    Join Date
    May 2021
    Posts
    3

    Linked subform updating on change focus


    I open a form with a linked subform. The OnLoad of the subform auto populates a couple of the subform fields. When i click in the subform, before doing anything else, the record is saved. Why? What triggers the save? I don’t want this because I want to option to close without saving.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    I suppose because just clicking randomly anywhere inside subform moves focus away from record in edit mode. Record is committed when 1) close table/query/form or 2) record in edit mode loses focus such as when moving to another record or otherwise or 3) run code to save. Don't use VBA to auto populate fields until you want to commit record. Possibly should be using DefaultValue property.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Join Date
    May 2021
    Posts
    3

    Smile

    Quote Originally Posted by June7 View Post
    I suppose because just clicking randomly anywhere inside subform moves focus away from record in edit mode. Record is committed when 1) close table/query/form or 2) record in edit mode loses focus such as when moving to another record or otherwise or 3) run code to save. Don't use VBA to auto populate fields until you want to commit record. Possibly should be using DefaultValue property.
    D’oh! That makes too much sense for this idiot. Also, it’s a continuous (sub)form, so clicking off the current record is just too easy. All I have to do is set focus somewhere within the current record when the form is shown. Thanks for setting me straight!

  4. #4
    Join Date
    May 2021
    Posts
    3
    Ah. Well. Actually that wasn't the fix, and I have no idea what would be. It might be possible to shift the auto-populating to some event that comes after setting focus and before user interaction, but life may be too short to find out which event is invariably appropriate. In the end, I shifted the auto-populating to the Form_BeforeUpdate event, which was good enough.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 10-23-2020, 07:13 AM
  2. Multiple picture change subform focus
    By ZOMB13 in forum Access
    Replies: 7
    Last Post: 04-26-2015, 12:36 AM
  3. Replies: 12
    Last Post: 01-05-2013, 06:51 PM
  4. Replies: 3
    Last Post: 11-04-2012, 09:25 AM
  5. Updating subform based on combo box change
    By kev921hs in forum Forms
    Replies: 3
    Last Post: 04-01-2010, 08:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums