Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Launch Applications from Access

Status
Not open for further replies.

Moss100

Technical User
Aug 10, 2004
584
GB
Hello All,

I would like to launch various applications from a form in my database.

My idea is to have a table containing program names and their file paths / shortcuts.

Is there some VBA code that will launch a program from Access?

I have tried the code below:

Code:
Application.FollowHyperlink "C:\Apps\Front_End\DIARY.accdb"

This works, but gives a security warning message each time.

Is there a better solution?

Many thanks Mark
 
OK - so I have now tried this and it works! Are there any other tips or suggestions I should be aware of?

Many thanks Mark

Code:
shell "msACCESS.EXE C:\Apps\Front_End\DIARY.accdb", vbNormalFocus
 
One problem I have is it will open multiple copies of the access program. Do I need to check to see if it is already open - if so how?

Thanks Mark
 
If you want to "launch various applications" - this is what I use:

Code:
Public Sub OpenDocument(strDocPath As String)
Dim G As Long
G = Shell("RUNDLL32.EXE URL.DLL,FileProtocolHandler " & strDocPath, vbNormalFocus)
End Sub

Just pass a valid path to the file and you can open it with the application that the file is associated with. It is like double-clicking on the file in Windows Explorer


---- Andy

There is a great need for a sarcasm font.
 
Thanks, that works well.

I notice that if I am opening an Access database, if the database is not currently open, then it will open it and set focus to it (so the new database is the active window).

If however the database has already been opened, then the focus does not change to the database you are trying to open (as it would from a normal desktop shortcut). Is there a way to get the focus to always go to the program that the user is trying to open?

Many thanks Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top