Results 1 to 3 of 3
  1. #1
    PhatRam32 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2012
    Posts
    11

    Running SAS program in a Macro

    As anyone successfully run a SAS program file within a Macro that includes other queries within MS Access.

    Basically I have my macro to run 3 items. The issue I'm having is that MS Access will proceed to Query1 before the SAS program is finished running and wanted to see if there was a way to tell MS Access to not run Query1 until the SAS program finished its run.

    RunCode () -This is where VBA calls and runs the SAS program
    OpenQuery (Query1)
    OpenQuery (Query2)

    VBA code to run SAS:

    Public Function RunSAS()
    Dim olesas As Object
    Set olesas = CreateObject("SAS.Application")
    olesas.Submit ("%include 'C:\DATA\Clinical Operations Reporting\Weekly\Reports\HepC\Files\SAS\report_pul l.sas_2a_after.sas'; ")
    olesas.Visible = True
    olesas.Quit


    Set oleasas = Nothing

    End Function

  2. #2
    Daralin is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Mar 2017
    Posts
    1

    Have you figured this out?

    Hi PhatRam32,



    Did you every figure this out, I have the same question.

    Thanks

    Jeremy

    Quote Originally Posted by PhatRam32 View Post
    As anyone successfully run a SAS program file within a Macro that includes other queries within MS Access.

    Basically I have my macro to run 3 items. The issue I'm having is that MS Access will proceed to Query1 before the SAS program is finished running and wanted to see if there was a way to tell MS Access to not run Query1 until the SAS program finished its run.

    RunCode () -This is where VBA calls and runs the SAS program
    OpenQuery (Query1)
    OpenQuery (Query2)

    VBA code to run SAS:

    Public Function RunSAS()
    Dim olesas As Object
    Set olesas = CreateObject("SAS.Application")
    olesas.Submit ("%include 'C:\DATA\Clinical Operations Reporting\Weekly\Reports\HepC\Files\SAS\report_pul l.sas_2a_after.sas'; ")
    olesas.Visible = True
    olesas.Quit
    Set oleasas = Nothing

    End Function

  3. #3
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Have you tried putting the queries inside the routine to run after the "Set oleasas=Nothing"?

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

Similar Threads

  1. Replies: 12
    Last Post: 10-03-2013, 12:32 PM
  2. Replies: 3
    Last Post: 06-15-2013, 08:05 PM
  3. macro running in order
    By dumbledown in forum Access
    Replies: 2
    Last Post: 09-03-2012, 08:05 AM
  4. running macro in another DB
    By AdrianoG87 in forum Import/Export Data
    Replies: 1
    Last Post: 09-30-2011, 12:31 AM
  5. Running module from Macro
    By Harley Guy in forum Modules
    Replies: 6
    Last Post: 10-27-2010, 11:05 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