Query by form with Combo box

J

Justin Busch

I am attempting to use a value supplied by a combo box in a query using
Access 2003. The values in the combo box are supplied by a "Select distinct
values" query.

The combo box is set to have its Row Source to the "distinctDates" query

The query that needs the value from the combo box has
Field: date
Table: master
criteria: [Forms]![form1]![combo1]![value]

I have set the event procedure for After Update to:
DoCmd.OpenQuery "queryByDate", acViewNormal, acEdit

However, once I choose a value from the combo box I receive an empty query
result. Am I missing a crucial step somewhere or am I going about this the
wrong way?

Any help would be appreciated.

Justin Busch
[email protected]
 
S

Sprinks

Hi, Justin.

"value" is not an object of your combo box control, it is a property. The
bang operator (!) delimits a parent object from a specific object in its
collection. Change the query criteria to:

[Forms]![form1]![combo1].value

or, more economically, since value is the default property of a form control:

[Forms]![form1]![combo1]

Hope that helps.
Sprinks
 
J

Justin Busch

Well I'll be, Sprinks!

Thanks very much, that's exactly what I needed.

Justin


Sprinks said:
Hi, Justin.

"value" is not an object of your combo box control, it is a property. The
bang operator (!) delimits a parent object from a specific object in its
collection. Change the query criteria to:

[Forms]![form1]![combo1].value

or, more economically, since value is the default property of a form control:

[Forms]![form1]![combo1]

Hope that helps.
Sprinks


Justin Busch said:
I am attempting to use a value supplied by a combo box in a query using
Access 2003. The values in the combo box are supplied by a "Select distinct
values" query.

The combo box is set to have its Row Source to the "distinctDates" query

The query that needs the value from the combo box has
Field: date
Table: master
criteria: [Forms]![form1]![combo1]![value]

I have set the event procedure for After Update to:
DoCmd.OpenQuery "queryByDate", acViewNormal, acEdit

However, once I choose a value from the combo box I receive an empty query
result. Am I missing a crucial step somewhere or am I going about this the
wrong way?

Any help would be appreciated.

Justin Busch
[email protected]
 
Top