Results 1 to 8 of 8
  1. #1
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936

    "Refresh All" in VBA


    Is there a way to code the "Refresh All" ribbon button? I have a form with multiple subforms and would like to refresh them all at the same time, just like the ribbon button does. The user can add subforms as desired but does not have the ability to go into the code, so I would prefer to avoid requerying them one by one.

  2. #2
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    Try Me.Requery in your main form in an appropriate event .

  3. #3
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Tried that - that only applies to the main form.

  4. #4
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    you can query the subforms too. Me.YourSubformControlName.requery

  5. #5
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Like I said, I don't want to do that. I am trying to find out if what I am asking is possible, I know there are lots of workarounds.

  6. #6
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    Try CommandBars.ExecuteMso "DataRefreshAll"

  7. #7
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Brilliant! It worked, thanks a lot.

  8. #8
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    Glad to help, Here is the trick to execute any commands in ribbon. Goto File>Options>Customise Ribbon.hover the mouse on a command in the left side box, the value in parenthesis is the string ID for a command to execute.

    Commandbars.Executemso StringID

    Mark the thread as solved.

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

Similar Threads

  1. "Refresh All" Command
    By rkalapura in forum Programming
    Replies: 4
    Last Post: 02-11-2021, 08:31 AM
  2. Equivalent of "Refresh All"
    By Sa'El in forum Programming
    Replies: 9
    Last Post: 08-09-2014, 03:09 PM
  3. Replies: 9
    Last Post: 01-27-2014, 09:53 AM
  4. Replies: 7
    Last Post: 06-27-2013, 10:56 AM
  5. Replies: 2
    Last Post: 02-21-2012, 01:35 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