Open Access Database with VBA

G

Guest

I want to open a specific Access DB from and Excel button. I tried a
previous sugestion in this forum and It would bring up access but not the
file. Here is what I have: (I'm so colse to being happy!)


Sub test()
On Error Resume Next
Set ac = GetObject(, "Access.Application")
If ac Is Nothing Then
Set ac = GetObject("", "Access.Application")
ac.OpenCurrentDatabase "c:\data\temp\temp.mdb"
ac.UserControl = True
End If
AppActivate "Microsoft Access"
End Sub
 

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