FancyPrairie
Programmer
From my current db, I open a form that exists in my library database (codedb). Upon pressing a button on the form, my code creates a query and saves it in my current db. I then want to open that query via DoCmd.OpenQuery "QueryName", acViewNormal. However, because the form and/or code is being executed within my library database (codedb or CodeProject), the DoCmd.OpenQuery is looking for the query in my library database rather than my current database.
What would be the syntax to force DoCmd.OpenQuery to run in my current database?
Here's a brief example of my code:
I have tried:
CurrentProject.Application.DoCmd.OpenQuery "TempQuery", acViewNormal
AND
Dim app as New Access.Application
Set app = GetObject(CurrentProject.FullName)
app.DoCmd.OpenQuery "TempQuery", acViewNormal
What would be the syntax to force DoCmd.OpenQuery to run in my current database?
Here's a brief example of my code:
Code:
Dim dbs as DAO.Database
Dim qdf as DAO.QueryDef
Set dbs = CurrentDb
Set qdf = dbs.CreateQueryDef("TempQuery", "Select...")
DoCmd.OpenQuery "TempQuery", acViewNormal
I have tried:
CurrentProject.Application.DoCmd.OpenQuery "TempQuery", acViewNormal
AND
Dim app as New Access.Application
Set app = GetObject(CurrentProject.FullName)
app.DoCmd.OpenQuery "TempQuery", acViewNormal