Query Using a Form Object as Criteria

G

Guest

Access XP, Windows XP

Hello,

I have a select query which uses a combo box on a form as its criteria. The
name of the form is frmSenateReports. The name of the combo box is Combo37.
In the criteria field I have entered the following:

[Forms]![frmSenateReports]![Combo37]

When I open the form and select a Senate District, for example 1st Senate
District, and click on the Preview Report button (this button run a report
that is based on the query), the report displays "Error" in the place where
names should be listed of those that are in the 1st Senate District.

Any thoughts on why this is not working properly?

Jeff
 
R

Rick Brandt

Jeff Bendert said:
Access XP, Windows XP

Hello,

I have a select query which uses a combo box on a form as its criteria. The
name of the form is frmSenateReports. The name of the combo box is Combo37.
In the criteria field I have entered the following:

[Forms]![frmSenateReports]![Combo37]

When I open the form and select a Senate District, for example 1st Senate
District, and click on the Preview Report button (this button run a report
that is based on the query), the report displays "Error" in the place where
names should be listed of those that are in the 1st Senate District.

Any thoughts on why this is not working properly?

Are you sure the ComboBox is not one where it contains one value while
displaying another? If so, do you need the held (bound) value or the displayed
value as your criteria? Your current syntax will return the value of the bound
column.
 
J

JohnFol

To confirm Ricks theory, add the following to the top row of the query

[Forms]![frmSenateReports]![Combo37]

This will then display the value in each row of the query

(or do a ctrl+G and ?[Forms]![frmSenateReports]![Combo37])



Rick Brandt said:
Jeff Bendert said:
Access XP, Windows XP

Hello,

I have a select query which uses a combo box on a form as its criteria.
The
name of the form is frmSenateReports. The name of the combo box is
Combo37.
In the criteria field I have entered the following:

[Forms]![frmSenateReports]![Combo37]

When I open the form and select a Senate District, for example 1st Senate
District, and click on the Preview Report button (this button run a
report
that is based on the query), the report displays "Error" in the place
where
names should be listed of those that are in the 1st Senate District.

Any thoughts on why this is not working properly?

Are you sure the ComboBox is not one where it contains one value while
displaying another? If so, do you need the held (bound) value or the
displayed value as your criteria? Your current syntax will return the
value of the bound column.
 

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