Northwind Question ?



I'm working my way through the Northwind sample database. I'm trying to see
how the query in the form Orders was created.
If you open the Orders form in Design View and look at the data source it
shows Orders Qry, and if you click the ... button you are taken into the
Orders Qry : Query Builder window which shows the usual query builder.
My question is a this query is not shown as a saved query in the Query
window of the main database window ? If I create a new form, and try to
build a query for the form data source I'm always taken to the SQLStatement
: Query Builder and this creates an sql statement which is shown as the data
source for the form ? So how did the creators of the Northwind database
enter this query wthout creating and saving a separate query ? Is the query
hidden in the Database Query window in some way ?

Jeff Boyce


I'm not looking at the NW db at the moment, but have done something similar.

I can open a form, create an "empty" combo box, then set the RowSource for
that combo box via the properties by clicking on the ellipses (...). When
I'm done in the query design window, I can click the "x" to close it, and
I'm prompted to save the SQL statement. Or, if I want to have a query
definition created, I can click the <Save> button first, then exit. If I
<Save>, I'm prompted for a query name.



I opened Northwind and as you say the 'Orders' form record source is
'Orders Qry'. 'Order Qry' however is a saved quury and is listed in
the database window. Perhaps the query has been marked hidden in your
file, or perhaps it's been deleted (in which case you would get an
error opening the form).



When the database window has the focus select 'Tools' > 'Options...'
from the menu bar. Ensure the 'View' tab is selected. In there you
should have a show group with check boxes for "Hidden Objects". If
this is selected you can see objects that have been marked as hidden.
To hide an object (or unhide it), right click the object (table, query,
form etc...) in the database window and choose Properties from the menu
that appears. At the bottom of the properties dialog that appears you
should have a hidden check box. If this is checked the object will be
hidden (unless hidden objects are set to be shown - see above)
otherwise it will not be hidden.

Rob Parker

If you initially generate the record-source of a form by using the
query-builder via the ... button on the form's recordsource property, you
are prompted to save the changes to the SQL statement and update the
property, not to save the query. The query is not accessible via the
queries tab in the database window.

If you look in the MSysObjects table (normally a hidden system object - you
can see it if you use Tools | Options | Show System Objects), you will find
these queries; they are named ~sq_fXXXX (if they are the recordsource for a
form; XXXX is the form's name) or ~sq_cYYYY (if they are the recordsource
for a combo-box; YYYY is the combo-box's name). They do not appear in the
Queries tab even if you are showing hidden and system objects. Their
details are also available via the (hidden system) table MSysQueries.

If you initially set the recordsource to an existing query, changes you make
in the query-builder from the form's recordsource property box will be saved
in the query.


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