Programmatically accessing queries?

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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?
 
Back
Top