Queries from VBA
I have the following code from a sub in an .mdb file, which works perfectly. However, I am trying to do pretty much exactly the same thing for a stored procedure in an .adp file. So far, I have been completely unsuccesful in doing this, any help would be greatly appreciated.
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim strSQL As String
Set db = CurrentDb
Set qdf = db.QueryDefs("Query3")
DoCmd.Close acQuery, "query3"
strSql = 'some functions that generate the sql code for the query in question
qdf.SQL = strSQL
DoCmd.OpenQuery "Query3", , acReadOnly
|