I am trying to write a VBA macro that will output the results of a SQL query run off an Access database.
The SQL script uses 4 different tables in the Access database, and the SQL script isn't saved as a query in the Access database.
How can I write a macro that links to the Access database, runs the SQL script I provide, and spits out the results into an Excel worksheet?
I really am not sure where to start with this. I've found this example code
Public Sub DoSQL()
Dim SQL As String
SQL = "UPDATE Employees " & _
"SET Employees.Title = 'Regional Sales Manager' " & _
"WHERE Employees.Title = 'Sales Manager'"
DoCmd.RunSQL SQL
End Sub
But I'm not sure how VBA knows where the "Title" table is? Any help is appreciated!!
Bookmarks