FancyPrairie
Programmer
I have created an access database that contains my library of routines (Lib.accdb). I then reference this library in my other databases (Other.accdb).
Via code in Other.accdb, I open a form that exists in my library database (Lib.accdb). On the library form is a button. Via the onclick event I issue the command Set qdf = dbs.CreateQueryDef("TempQuery", strSQL). Following this line of code I issue the command DoCmd.OpenQuery "TempQuery", acViewNormal.
I get an error indicating that it can not find "TempQuery". I'm assuming that the "CreateQueryDef" is creating the query in my library db (Lib.accdb) while the DoCmd.OpenQuery is attempting to open the query in Other.accdb. Or visa versa. The reason I believe this must be the case is because if I open my library database and then open the form and press the button, DoCmd.OpenQuery works.
Is there a way to create the query and open it all within the same database?
Via code in Other.accdb, I open a form that exists in my library database (Lib.accdb). On the library form is a button. Via the onclick event I issue the command Set qdf = dbs.CreateQueryDef("TempQuery", strSQL). Following this line of code I issue the command DoCmd.OpenQuery "TempQuery", acViewNormal.
I get an error indicating that it can not find "TempQuery". I'm assuming that the "CreateQueryDef" is creating the query in my library db (Lib.accdb) while the DoCmd.OpenQuery is attempting to open the query in Other.accdb. Or visa versa. The reason I believe this must be the case is because if I open my library database and then open the form and press the button, DoCmd.OpenQuery works.
Is there a way to create the query and open it all within the same database?