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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Launching Access from Access 3

Status
Not open for further replies.

DMHCCI

Vendor
May 9, 2003
22
US
Is there a way to call or run or launch an Access.mdb from an Access.mdb? I have a customer with multiple applications and would like to develop a Master Menu that would call up other access programs using buttons or links. I have been putting them in a folder up until now and making shortcuts to each database but would prefer a slicker way to do this.
 
Here is some code I put behind an option group on a Form. You can experiment with this.

Option Compare Database
Option Explicit
Public pubAppAccess As Access.Application, pubOldAccess As Access.Application
Public pubFilePath As String

Private Sub optOnLine_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

' Open Access project.
pubFilePath = "C:\compudyne\xxxx\projects\remotepubs.adp"
Set pubAppAccess = New Access.Application
pubAppAccess.OpenAccessProject pubFilePath

pubAppAccess.Application.RefreshDatabaseWindow
pubAppAccess.Application.Visible = True
DoCmd.Close

End Sub

Private Sub otpOffLine_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

' Open Access project.
pubFilePath = "C:\compudyne\xxxx\projects\localpubs.adp"
Set pubAppAccess = New Access.Application
pubAppAccess.OpenAccessProject pubFilePath

pubAppAccess.Application.RefreshDatabaseWindow
pubAppAccess.Application.Visible = True
DoCmd.Close

End Sub
 
Probably a cleaner way to do this, but if you make an old dos style batch file that says

c:\progra~1\msoffice\msaccess c:\myfiles\mydb.mdb

Call it c:\mybatch.bat

then you can with VB say shell ("C:\MyBatch.Bat") and it will launch.

ChaZ

"When religion and politics ride in the same cart...the whirlwind follows."
Frank Herbert
 
You might look at the hyperlink properties of the control - I came across that tip in someone elses post, tried it and it worked fine. My issue is That I really want to find a way to transparently 'redirect' to open an MDE db as soon as the MDB is opened, and close the MDB. not having much luck yet.
 
You don't even need to create the batch file.

You can just use the Shell() command to run the shortcut:

Shell c:\progra~1\msoffice\msaccess c:\myfiles\mydb.mdb

Ed Metcalfe.

Please do not feed the trolls.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top