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

Open Access from Excel

Status
Not open for further replies.

wabahn

Technical User
Oct 23, 2008
20
US
I have an excel spreadsheet that is linked to an Access Database. Right now I have the operator open the spreadsheet, run a macro to manipulate a text file then open the database from a desk top short cut. I would like to give them a button in Excel that takes them to the database directly so that they can run forms and queries.

Does anyone have a simple code that would open the database?

Thanks
 
Thanks - just what I was looking for. [thumbsup]
 
Oops - the open access works fine, but when I toggle back to Excel, I get a run time error 2485. I have to clear the error to do anything else in Excel. What am I missing in my code to allow toggling back to excel?

Here is the code:

Sub OpenAccess()
'Public Sub OpenAccess()

Dim app As Access.Application
Set app = CreateObject("Access.Application")

app.OpenCurrentDatabase ("file location and name")
app.Visible = True
app.DoCmd.RunMacro ("M1")

Set app = Nothing

End Sub

========
(Note: I also had to go into tools/references and enable microsoft access).
 
I got the problem solved. I just needed to comment out the appl.DoCmd.RunMacro line.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top