Application - Path & runtime

C

chris

Hi,

Can I find the path of MSAccess application and whether is a runtime or full
version by accessing any of it's properties ?

I will open access with command below:

Set msa_APP = GetObject(, "Access.application")

Thanks a lot in advance!
 
D

Douglas J. Steele

msa_APP.SysCmd(acSysCmdAccessDir) should return the path to the directory in
which msaccess.exe is installed.

msa_APP.SysCmd(acSysCmdRuntime) should return True if it's the run-time
version.
 
D

Daniel Pineault

Douglas,

I tried your code (out of personal interest) and I get an error (run-time
error 424, object required). But because I knew that
Application.SysCmd(acSysCmdAccessDir)
worked so I switched your

msa_APP.SysCmd(acSysCmdRuntime)
to
Application.SysCmd(acSysCmdRuntime)

And it worked (I think, you could tell me otherwise). Is there a difference
between msa_APP and Application? Do I need to use a reference Library? Is
there a preferred method (reason to avoid the Application....)?

Thank you,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
D

Douglas J. Steele

I suspect that they'll end up returning the same thing, but realistically
Application. would refer to the current running code, while msa_App should
refer to the instance of Access that was instantiated using GetObject(,
"Access.application")

Of course, thinking about it, the original question doesn't really make
sense. Assuming that Chris's code is running in Access, msa_App is going to
be an instantiation of the same application in which the code is running.
 
C

chris

I am calling the command below (msa_APP is declared as object)

Set msa_APP = GetObject(, "Access.application")

from VB, that's why I needed to retrieve the path of MS Access opened.

Thanks a lot for your help.
 
D

Douglas J. Steele

But since you're presumably running from within Access, that command is
likely going to return the instance of Access in which your code is running.

If you're not running the code from within Access, where are you running it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top