using form to enter criteria

  • Thread starter Thread starter Stella K.
  • Start date Start date
S

Stella K.

Hi all,

I haven't used Access much and I'm learning as I go, but I
haven't found a solution to the following problem.

I want users to be able to select the parameters for a
query-based report from a drop-down list. I have created a
combo box on an unbound form, but when I enter the
following on the criteria line

[Forms]![Form1]![ComboName]

the form does not appear when I run the query, just a
standard prompt box with same text. When I run the report,
the form appears, I can select an entry from the combo
box, but it does not set the parameters for the query -- I
just get #error as data.


Any advice? (I'll crosspost in the reports group since I'm
not sure where the problem lies).

Thanks in advance.
 
Dear Stella:

It seems you are expecting that running the query will cause the form
to open, and perhaps that the query will then wait till the user has
made a selection in the combo box. But what if they make a mistake in
making that selection? If the query takes off right then, when the
user first makes a selection, there would be no opportunity to correct
that before the query runs.

Well, what it is is this. It doesn't work at all the way you are
expecting. Rather, you must ensure that the form is already opened
and, if necessary, that the combo box has a value in it. This is very
commonly done by having a command button right on that form initiates
the query. This command button can be mad visible or not depending on
whether all the necessary conditions are met to make the query
possible, such as possibly ensuring that the combo box has a valid
value entered. This avoids all the potential problems, like not
having a form open that is referenced by the query.

Hi all,

I haven't used Access much and I'm learning as I go, but I
haven't found a solution to the following problem.

I want users to be able to select the parameters for a
query-based report from a drop-down list. I have created a
combo box on an unbound form, but when I enter the
following on the criteria line

[Forms]![Form1]![ComboName]

the form does not appear when I run the query, just a
standard prompt box with same text. When I run the report,
the form appears, I can select an entry from the combo
box, but it does not set the parameters for the query -- I
just get #error as data.


Any advice? (I'll crosspost in the reports group since I'm
not sure where the problem lies).

Thanks in advance.

Tom Ellison
Ellison Enterprises - Your One Stop IT Experts
 
Dear Stella:

I suggest you put the combo box on the same form with a command button
that starts the report. That way, the combo box will ALWAYS be
available for the report's query to see.

In addition, if making a selection in the combo box is mandatory for
running the report, you may want to make the combo box Visible = False
when the form opens and only make it visible when the combo box has
had a selection made. You may want to put a label directly behind the
combo box that says "make your seleciton first" so users don't just
wonder where the button to run the report has gone.

Alternatively, you can have the command button visible all the time.
When clicked, it checks the combo box. If no selection has been made,
it provides a message box explaining what the user must do.
Otherwise, it opens the report.

Hi all,

I haven't used Access much and I'm learning as I go, but I
haven't found a solution to the following problem.

I want users to be able to select the parameters for a
query-based report from a drop-down list. I have created a
combo box on an unbound form, but when I enter the
following on the criteria line

[Forms]![Form1]![ComboName]

the form does not appear when I run the query, just a
standard prompt box with same text. When I run the report,
the form appears, I can select an entry from the combo
box, but it does not set the parameters for the query -- I
just get #error as data.


Any advice? (I'll crosspost in the reports group since I'm
not sure where the problem lies).

Thanks in advance.

Tom Ellison
Ellison Enterprises - Your One Stop IT Experts
 
Back
Top