Programmatically accessing queries?

G

Guest

This may be stupid user error, but I'll ask anyway

I'm using Access 2002 and successfully accessed (I thought...) the stored queries in the database's QueryDefs property. Once I got the code working, I added a new stored query which doesn't show up in the QueryDefs list. I've exited out of Access thinking that may be an issue (it doesn't appear to be...), followed by rebooting (which didn't help either). After neither action have I been successful in seeing the new query appear in the QueryDefs list. Does it matter how the query is created within Access? Once I restart Access, I do see the new query (QueryDef) there, but I can't seem to access it programmatically. Any thoughts

Thanks

Jim
 
A

Allen Browne

Try:
RefreshDatabaseWindow

If you still cannot access it programmatically, there may be something odd
about its name, such as a trailing space? Try looping through the QueryDefs
and listing them:

For Each qdf in dbEngine(0)(0).QueryDefs
Debug.Print qdf.Name
Next

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Jim said:
This may be stupid user error, but I'll ask anyway.

I'm using Access 2002 and successfully accessed (I thought...) the stored
queries in the database's QueryDefs property. Once I got the code working,
I added a new stored query which doesn't show up in the QueryDefs list.
I've exited out of Access thinking that may be an issue (it doesn't appear
to be...), followed by rebooting (which didn't help either). After neither
action have I been successful in seeing the new query appear in the
QueryDefs list. Does it matter how the query is created within Access?
Once I restart Access, I do see the new query (QueryDef) there, but I can't
seem to access it programmatically. Any thoughts?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top