Hi All
This has probably been asked a hundred times before, but I have had no luck with searches.
I am currently trying to make a button in excel where once pressing, my acces database opens, the desired query opens, then this data is copied over to my excel sheet (from where I pressed the button).
I am new to VBA in general, here is the code I have written so far which opens the database. I am lost past this point:
Sub OpenAccess2()
On Error Resume Next
Dim wrkbook_dest As Workbook
Dim DATABASE As String
Dim oApp As Access.Application
DATABASE = "file path blah blah blah"
Set wrkbook_dest = ActiveWorkbook
Set oApp = CreateObject("Access.Application")
oApp.Visible = True
oApp.OpenCurrentDatabase DATABASE
oApp.DoCmd.OpenQuery "query name"
End Sub
Everything works up to this point, the DB and Query open, but after this point i am lost.
FYI I am using excel 2010, and access 2003. Also I am connected to a workgroup, so if you know a way I can bypass the password entry (by having my password somewhere in the vba code), I would appreciate it, but it is not essential since I can just type it in and the code keeps running after it has been entered.
Thanks!