organize queries

J

jw

Hi,

I like to keep all my queries and I am wondering if there
is a way to separate them into folders.

For example, I would like to keep queries for forms in
one folder, and separate out queries that I use
frequently from those I just would like to have for
reference.

Right now, my query box is so full, it is challenging to
find a certain query.

Thank you for your attention to my question!
 
L

Larry Daugherty

One thing that might help you separate them is to create a naming convention
that will cause related queries to appear together in the Query window.

There is something else that's even more useful, keep the queries in the
forms and reports which use them. That protects the queries from accidental
modification and keeps the Query window clear.

hth
 
J

jw

Thanks for the ideas!

How do I keep a query in the form that uses it?

Thanks for your help!
 
L

Larry Daugherty

The best way to do it depends on where you start. ...If you have a lot of
named queries I recommend that you take notes of what you've done so that
you can recover if necessary. Failing that, make a backup copy of your
application before you start.

Assuming you don't already have a named query, base your form design on the
underlying main table. Open the form properties and click on the data tab.
Click the ellipsis (...) to the right of the Record Source text box. You'll
be warned that you are about to create a query based on the table. OK.
That opens the QBE grid. Design your query. Do NOT click the disk icon to
save the query. Click the X. You'll be asked if you want to save changes
to the query and update the property. Answer YES. You now have the query
on which the form is based contained within the form.

Assuming you already have a named query in the Database|Query window; Get
to the QBE grid as above. Change to SQL view. Select the entire SQL
statement and press CRTL-C to copy it to the clipboard. Escape or X your
way back out to the form's Data properties and in the Record Source
property, delete the named query. Click on the elipsis and when the QBE
grid opens change to SQL view. Press CTRL-V to paste in the saved SQL
statement. You can change to grid view if you wish. Do NOT save to disk!
X out and answer YES to the question "Save changes and update the property"?
You'll be back at the form's data properties and you'll notice that the
Record Source now reads "Select ..." That leaves a named query in the
Database|Query window. If you are sure that no other functionality depended
on that query you can delete it.

hth
 

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