Form that controls queries.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to use a form to set the criatria for the underlying query.

Example: I would like to see only the records that a apply to account "AAM"
or any other account name that is within the database.

Right now I am resetting the criteria from design view everytime I want to
look at a different account..
 
Try this:

Make a select query based on the table or tables of information you want to
review. Link the tables as appropriate. In the Critera: box, type "[AAM]" or
what ever is appropriate for your situation. You can review how the query
works by selecting the proper datasheet view. Save the query.

Next, create a form based on the query you just created, import the fields
you want to review, organize the fields as you would like them to appear on
the form. Run the form. You will be presented with a dialog box that requests
information for the field of the query. Enter "AAM" or what ever your
situation requires. The found information will now appear in your form.
 
Whoops, made a mistake. Instead of "AAM" inside the brackets, type "Enter
criteria" (or Company name or whatever name you'd like to see in the dialog
box) between the brackets.
 
I competed my form with the Form Wizard...was not presented with a dialog box
that requests information for the field of the query.

Jim Ory said:
Try this:

Make a select query based on the table or tables of information you want to
review. Link the tables as appropriate. In the Critera: box, type "[AAM]" or
what ever is appropriate for your situation. You can review how the query
works by selecting the proper datasheet view. Save the query.

Next, create a form based on the query you just created, import the fields
you want to review, organize the fields as you would like them to appear on
the form. Run the form. You will be presented with a dialog box that requests
information for the field of the query. Enter "AAM" or what ever your
situation requires. The found information will now appear in your form.
--
Jim Ory


potter said:
I want to use a form to set the criatria for the underlying query.

Example: I would like to see only the records that a apply to account "AAM"
or any other account name that is within the database.

Right now I am resetting the criteria from design view everytime I want to
look at a different account..
 
Thank you...it worked...but it's not quite what I want. What if I want to
see all accounts? Leave the field blank? Is there a way for me to use a
lookup or dropdown combo box vs typing into text box? Based on the accout
selected could I direct certain subforms to open/close...etc?
 
Yes, leaving the dialog box empty will bring up all data.

I use the combo box method to bring up record(s) in a couple of databases I
use. The Wizard is very good at doing that. With the form in design view and
the wizard button selected, position your combo box/list box on the form and
follow the directions.

I don't know what you're trying to do with 'certain subforms' relating to
'accounts', but, I believe you can do what you want with a little code.

Just a thought here, but if you had 'certain accounts' that carried a
special number or letter in a field, to differentiate from other accounts,
then when that 'account' was selected, it would show the subform linked to
that number or letter. I think a select query, using the 'special
number/letter' to make the subform may be a start. I have no reason to do
that in my databases, so maybe someone with more knowledge can help you with
the coding.

Post another question regarding the subform idea you have.
 
Back
Top