Results 1 to 15 of 15
  1. #1
    Bospeentje is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    15

    refresh all (sub)forms automatically when editing a field on one subform

    I have a form with several subforms. When I edit a field on one subform (or delete a record there), I want all (sub)forms to refresh automatically and inmediately.
    I tried to do this by calling a me.refresh Function (AfterUpdate) on the main form. This works, but NOT when I delete a record on the subform... it seams that Access doesn't see this as an (After)Update.
    Please, any suggestions to get this work?

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Your going to have to refer to the subform(s) and then refresh them.
    HTH

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    FYI: A Requery is required in order to refresh the recordset after a delete.

  4. #4
    Bospeentje is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    15
    Hmmm... question is: how and at which point do I refresh/requery the forms/dataset?
    I want all forms (whole screen) to refresh automatically after editing or deleting a field (record) on a subform, without any specific keystrokes for the users...
    Seems to me I have to add a function or code to the specific field on this sub-form.
    (help!)

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Create a button on the Main Form and use the click event to add code that Requeries each of your SubForms. Once you have it performing as desired you can delete the button and just call the procedure from any AfterUpdate event you want. Here's the syntax for referring Form elements in Access: http://access.mvps.org/access/forms/frm0031.htm

  6. #6
    Bospeentje is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    15
    Tnx RuralGuy, I have tried that and indeed it works fine... but not when I delete a record on a subform. It appears that Access doesn't see that as an update event, so the AfterUpdate event can't be called.
    If only I knew how to call this code when deleting a record.

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    How are you deleting the record?

  8. #8
    Bospeentje is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    15
    The subform is a continuous form with just one field (record) and selection buttons. I delete a record by selecting it with the selection buttons and simply press delete.
    So after this deleting, all forms should be refreshed.

  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you tried calling your Button code from the AfterUpdate event of the SubForms? If you could provide a sample db I could play with it a bit.

  10. #10
    Bospeentje is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    15

    test version

    I have called a me.refresh function on the main form, at an AfterUpdate event in the record on the subform. This only refreshes every form after editing the record on this subform, not after deleting a record... if you would try and figure this out, I would be very gratefull.

    I have attached a test db.
    The main form is "Frm_medewerker"
    The subform in question is "Subformulier Tabel_medewerker_producten", the field "product"
    Attached Files Attached Files

  11. #11
    Bospeentje is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    15
    Oh btw... in this db the refresh button on the main form still has a refresh macro attached to it.

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    After fixing some of the language issues, when I run the Frm_medewerker and select a record on the Subformulier Tabel_medewerker_producten and hit the Delete key on the keyboard, the SubForm displays accurately. Maybe I'm doing something different than you.
    Attached Files Attached Files

  13. #13
    Bospeentje is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    15
    When you say "the Subform displays accurately" you mean the sub-form Subformulier Qu_opleidingen_bij_producten_en_niveau is updated automattically???
    Because that's what should be happening, but still doesn't work on my computer. I still need to hit the refresh button on the main form to refresh all subforms. Even tried it with your attached file with the fixed language issues.

    Would it be possible that this is an Access setting or something like this?!?

  14. #14
    jgitaunjoroge is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Location
    Kenya
    Posts
    5
    can you translate the database into English

  15. #15
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I'm sorry Bospeentje, it looks like I just dropped this thread completely. Did you ever resolve your issue?

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

Similar Threads

  1. automatically refresh import from file.
    By skan in forum Access
    Replies: 6
    Last Post: 09-08-2014, 11:12 AM
  2. Replies: 9
    Last Post: 08-13-2014, 07:55 AM
  3. Replies: 5
    Last Post: 03-01-2013, 09:17 AM
  4. Automatically Update Field on Subform?
    By batowl in forum Forms
    Replies: 2
    Last Post: 02-08-2013, 08:16 AM
  5. Automatically Refresh datasheet/tables
    By akira in forum Access
    Replies: 4
    Last Post: 02-07-2012, 01:39 PM

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