Results 1 to 4 of 4
  1. #1
    Davide is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Jul 2020
    Posts
    40

    form field update

    Dear all,



    I am updating the field control_level of the main form from a subform. Unfortunately, the new value won't show up (and the associated table won't update) until the following iteration, so that the field is always one step behind. This is the code I use in VBA:

    Code:
    Forms![main_form]!Control_level = ControlLevel
    DoCmd.RunCommand acCmdSaveRecord
    It does work if I update a field in the same subform, as the run command will do that, but not in the parent (main) form.
    Any suggestion? thanks.

    Davide

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    5,030
    As it is in a subform you can use Me.Parent.ControlName
    I would expect that SaveRecord to apply to the form it is in (the subform)?
    You could try the Dirty method?

    Code:
    Me.Parent.Dirty = False
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Davide is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Jul 2020
    Posts
    40
    Thanks,
    but I think I could have just solved adding the following line of code:

    Code:
    Forms.main_form.Refresh
    I have to do more tests, but it seems it is working.

  4. #4
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,658
    What event are you using?
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

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

Similar Threads

  1. update form field
    By Davide in forum Forms
    Replies: 1
    Last Post: 07-01-2020, 08:17 AM
  2. Field Update By Form
    By bandara in forum Access
    Replies: 1
    Last Post: 04-18-2020, 11:51 AM
  3. Replies: 4
    Last Post: 03-27-2018, 09:19 PM
  4. Replies: 6
    Last Post: 04-26-2013, 10:07 AM
  5. Replies: 3
    Last Post: 09-20-2012, 11:23 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