Parameter query

D

Darhl Thomason

Ok Nikos,

It's over my head. So basically what I'd like is to have only one basic
form, and be able to hit different queries on it. Like one query is sorted
by owner then storenumber. Another query is sorted by storenumber, another
query is sorted by storename.

Then I'd like to be able to hit reports from it as well, based on whatever
query/filter is currently active. Hope this makes sense...Hope even more
that it's possible.

Let me know, I'm willing to do as much as I can, but like I said, this is
beyond my meager capabilities.

Thanks!

Darhl
 
N

Nikos Yannacopoulos

So basically what I'd like is to have only one basic form, and be able to
hit different queries on it.
Now you're talking! That's the way to go.

Like one query is sorted by owner then storenumber. Another query is
sorted by storenumber, another query is sorted by storename.
Since the only thing that changes is the sort order, you can use one
form only, and change its recordsource at runtime through code. You
could use, say, a listbox or combo or option group on the form itself,
and change the recordsource dynamically, selecting a saved query. I
would take it one step further, though, and assign the recordset SQL in
the form's Open event through code (form's recordsource property in form
design left blank), and change it dynamically in the same manner,
getting rid of the saved queries altogether.

By the way, note that, although not necessarily applicable in this case,
loading a form's recordset through code can make a huge improvement in
the loading time in a split app over a network.

Then I'd like to be able to hit reports from it as well, based on whatever
query/filter is currently active. Hope this makes sense...Hope even more
that it's possible.
Makes perfect sense, and is absolutely feasible. The logic is exactly
the same: one report, load the recordsource on open (actually just
assign the form's recordsource as the report's recordsource in your
case), look at the selections on the form to apply the pertinent sorting
and filtering. Two buttons on the form, one to preview the report, one
to print it. Done deal.


HTH,
Nikos
 
D

Darhl Thomason

Woo Hoo! This is awesome...thanks so much for your help!

So I took what you showed me, and added a 2nd option group to select between
open stores and all stores. It works fine, it defaults to open stores, but
the option button isn't selected. On your option group the owner/store
number option is defaulted and is selected in the option group as default...

Thanks again!

d
 
D

Darhl Thomason

Boy, if I'm not careful I may actually learn something. I figured it out.
Now I need to figure out how to add an additional option in the selection.

d
 

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