Oddly named QueryDef not visible in Queries pane

T

teddysnips

I posted earlier about a database that I couldn't add to SourceSafe.
For the moment, I don't really need the source code control elements,
but I need to examine all the objects in the database because I'm
going to rename some of the queries, columns etc. and need to know
where they're referenced in the front end.

I'm using some code that I found in this group that loops through all
the database objects and use the application.SaveAsText to write them
to a file: this bit goes through the querydefs:

For i = 0 To db.QueryDefs.Count - 1
app.SaveAsText acQuery, db.QueryDefs(i).Name, _
sExportLocation & "Query_" & db.QueryDefs(i).Name & ".txt"
Next i

However, it's barfing because it can't open a file that it's trying to
name with the

"Query_" & db.QueryDefs(i).Name & ".txt"

concatenation. The value of QueryDefs(i).Name at that point is:

~sq_cfrmQuestionnaire~sq_cVisited website before?

Huh? I've looked in the list of queries and there are no queries that
look ANYTHING like this. Is the .Name property of the QueryDef object
different somehow from the name that appears in the Queries pane?

Thnks

Edward
 
S

Stefan Hoffmann

hi Teddy,

The value of QueryDefs(i).Name at that point is:

~sq_cfrmQuestionnaire~sq_cVisited website before?

Huh? I've looked in the list of queries and there are no queries that
look ANYTHING like this. Is the .Name property of the QueryDef object
different somehow from the name that appears in the Queries pane?
When you assign a adhoc-query as record source to a form/report or to
the rowsource of a combo or list box, then it is stored as such a query.

I can't remember the correct syntax, but should be the query of your
ComboBox called Visited on your form frmQuestionnaire.


mfG
--> stefan <--
 
T

teddysnips

hi Teddy,





When you assign a adhoc-query as record source to a form/report or to
the rowsource of a combo or list box, then it is stored as such a query.

I can't remember the correct syntax, but should be the query of your
ComboBox called Visited on your form frmQuestionnaire.

Spot on! Many, many thanks.

Edward
 
G

Guest

And you don't want to save that as text, because there is no way
to restore hidden system queries like that from text. They are
automatically recreated from the form.

(david)
 
T

teddysnips

And you don't want to save that as text, because there is no way
to restore hidden system queries like that from text. They are
automatically recreated from the form.

(david)

Thanks. However, for research purposes (to determine in which forms,
queries, reports and macros certain tables and columns are referenced)
this will be fine.

Edward
 

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