Access version in CreateObject

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dima69
    Recognized Expert New Member
    • Sep 2006
    • 181

    Access version in CreateObject

    Hi all.
    I use a following code to run a procedure in another application:
    Code:
    Dim App as Access.Application
    set App = CreateObject("C:\MyApp.mde")
    App.Run "MyProc"
    ...
    The problem is that when using CreateObject I cannot determine which version of Access will be started for App.
    So if my main application supports Access2K2, and the user has Access2K installed (in addition to Access2K2), CreateObject may return Access2K application - even if calling application is running on Access2K2.

    So the question is how to get the Application object of the desired Access version ?
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by dima69
    Hi all.
    I use a following code to run a procedure in another application:
    Code:
    Dim App as Access.Application
    set App = CreateObject("C:\MyApp.mde")
    App.Run "MyProc"
    ...
    The problem is that when using CreateObject I cannot determine which version of Access will be started for App.
    So if my main application supports Access2K2, and the user has Access2K installed (in addition to Access2K2), CreateObject may return Access2K application - even if calling application is running on Access2K2.

    So the question is how to get the Application object of the desired Access version ?
    1. Your syntax for the CreateObject() Function will not work in its current context. The correct Procedure is:
      [CODE=vb]CreateObject(cl ass, [servername])

      Dim xlApp As Excel.Applicati on
      Set xlApp = CreateObject("E xcel.Applicatio n")[/CODE]
    2. The specific Version is not required in the class Argument, but if you so desire, you can determine the Version by querying the Version Property of the Application Object as in:
      [CODE=vb]Application.Ver sion[/CODE]

    Comment

    • dima69
      Recognized Expert New Member
      • Sep 2006
      • 181

      #3
      Originally posted by ADezii
      1. Your syntax for the CreateObject() Function will not work in its current context. The correct Procedure is:
        [CODE=vb]CreateObject(cl ass, [servername])

        Dim xlApp As Excel.Applicati on
        Set xlApp = CreateObject("E xcel.Applicatio n")[/CODE]
      2. The specific Version is not required in the class Argument, but if you so desire, you can determine the Version by querying the Version Property of the Application Object as in:
        [CODE=vb]Application.Ver sion[/CODE]
      1. The syntax is correct. It's the alternative syntax. Moreover, It's the only one that will work in case you create Access Runtime application object (ART cannot create object without database)
      2. Querying the version doesn't really help to solve the problem, if the version is not the one I need :)

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        Originally posted by dima69
        1. The syntax is correct. It's the alternative syntax. Moreover, It's the only one that will work in case you create Access Runtime application object (ART cannot create object without database)
        2. Querying the version doesn't really help to solve the problem, if the version is not the one I need :)
        I apologize for the misinformation - I was not aware of the alternative syntax as it relates to the Access Runtime Application Object. Thanks for the info.

        Comment

        Working...