Names of Embedded Queries

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 17:36
Joined
Feb 28, 2001
Messages
30,558
I am building a self-documenter procedure with VBA, including some cross-reference info. Mostly it works well, but I have a few gaps. One of them has to do with embedded queries.

When enumerating queries in AC97, using the syntax:

For Each qdf in querydefs
...
strQueryName = qdf.Name
...
next qdf

I run across queries with names that begin with (and often include) the text fragment "~sq_x" where x is a lower-case letter. I have decided that such queries represent embedded queries that might be either a validation query resulting from a combo box or embedded record sources (where when you look at a form's RecordSource box you don't see a name, you see an SQL statement.)

Does anyone know how those ~sq_x names are assigned? In particular, I am trying to find out the meanings associated with "x" where so far, I have seen "x" equal s,f,d, and r.

Can anyone at least point me in a good direction? So far, searching the Access Help files has not produced anything, and no other reference I have found tells me anything, either. Any and all help will be gratefully appreciated.



[This message has been edited by The_Doc_Man (edited 03-09-2001).]
 
I am not 100%, infact not 50% and may even be giving you total rubbish. I have seen suffixes c,f,d and r and suspect that they may relate to objects and controls, i.e. f = form recordsource, c = controlsource on a form control, r = report recordsource and d = controlsource on a report control.

You should be able to test this out by creating a simple one form, one report db and experimenting.
Hope this helps.
 
Keith, thanks for your attention. I have not stopped my research in this matter.

As near as I can tell, "c" is used when you have a lookup or validation for a control, so your "C for Control" guess is probably good. The "R for Report record source" and "F for Form record source" are also good calls. And I have tagged "D" as the thing that relates a subform or subreport to its parent form or report through a particular field on the parent form.

I did some further investigation. The R and F cases usually start out as "SELECT * FROM {original recordsource};" - and stay that way UNLESS you turn on a filter or grouping at the form/report level. In that case, you find that the hidden query has been modified to include a "WHERE" clause or a "GROUP BY" clause.

Of course, it makes oddball sense in a way. You would start with the simplest query - an unqualified "SELECT *" from the original source of your data. Then you locally change it (separate from the original record source) if you change the filter or grouping conditions. That would be the easiest way to assure that changing a form's filter doesn't affect the underlying data.

But my question still stands. Does anyone know of a reference book that discusses these synthesized names and what all the possible cases are for the lower-case letters that end the "~sq_x" sequence? I have not been able to find constants (using Object Browser) that relate to the possibilities, but that doesn't mean they aren't there. It just means I have not found them yet.
 

Users who are viewing this thread

Back
Top Bottom