opening access database using macro

R

rtphilips

Hi

I have a access database "test.mdf"

While running a macro I want to open this database

Please provide some solution

Thanks
 
Z

Zack Barresse

Hi there,

You can use the FollowHyperlink method, it will work for almost any program.
An example would look like ...


Option Explicit
Sub testingAccess()
Dim strPath As String, strName As String

'Change as desired..
strPath = "C:\YourFullPathNameHere\"
strName = "test.mdb"

On Error GoTo ExitSpot
ActiveWorkbook.FollowHyperlink strPath & strName, NewWindow:=True
Exit Sub

ExitSpot:
MsgBox Err.Description
End Sub


HTH
 
C

code_hungry

I have been looking for a "fit all" solution to opening files. I work in a
place where drive letters change depending on the department, so I have to
code for server paths. So far I have only been able to get huge amounts of
code to open an Office app within a diferent Office path. Yours was the
simpliest and the best.

Thanks. High Rating for you dude!!!
 

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