+ Reply to Thread
Results 1 to 6 of 6

AfterRefresh

  1. #1
    Registered User
    Join Date
    05-03-2005
    Posts
    16

    Unhappy AfterRefresh

    Hello!

    I looked around to see how to incorporate the query AutoRefresh event with no success. I'm just a beginner with VBA and I don't know how to use the code.

    Here is the link that explains how to use the Query AfterRefresh event... http://support.microsoft.com/kb/213187

    Here is my code:
    Please Login or Register  to view this content.

    As you can see, it's a simple code to open the workbook, refresh the linked query (from Access), save and close it.

    Can you please help?

    Thanks in advance!

  2. #2
    Registered User
    Join Date
    05-03-2007
    Posts
    3
    What exactly is happening, the code looks good...My guess is that the refresh did NOT complete before you did the save and close....

    Not sure how to wait until done refreshing, but that may be something to look at...easy enough to test, just remove the save and close and see if it works....

  3. #3
    Registered User
    Join Date
    05-03-2005
    Posts
    16
    That's exactly what's happening. The link above (the one from microsoft support) explains a way around the problem but I don't know how to incorporate it to my code.

  4. #4
    Registered User
    Join Date
    05-03-2007
    Posts
    3
    ahh, I see. So what you probably should do is perform the save and close in an AfterRefresh Sub...see MS note below...

    NOTE: To use the AfterRefresh event, in the above example, you can replace the macro name "qt_BeforeRefresh(Cancel As Boolean)" with "qt_AfterRefresh(ByVal Success As Boolean)." Also, change the message box text to an appropriate post data-refresh message.

  5. #5
    Registered User
    Join Date
    05-03-2005
    Posts
    16
    That is exactly the area that I need help with! Can someone help me? I will appreciate it!
    Last edited by JSoto; 05-03-2007 at 06:28 PM.

  6. #6
    Registered User
    Join Date
    05-03-2005
    Posts
    16
    Guys,

    Here is the solution to my problem in case you need it.

    I finally figured it out!

    This code goes on a Module:
    Please Login or Register  to view this content.
    This code goes on a Class Module:

    Please Login or Register  to view this content.
    Have fun!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1