Combo box selection

J

J Austin

I have a combo box that opens a macro "After Update". The macro opens a
selection query. I have tried to put the combo box selection in the
selection critieria of the field being filtered, but get a dataset with no
selections. I created the following code from the Expression Builder. I've
tried to find the proper syntax but have not found a direct reference on how
to capture combox selections.

[Forms]![Interface_Form_Cities]![Combo2].[City_Name].[AfterUpdate]

Thanks in advance,
 
J

Jeff Boyce

If you want to refer to the value in the control in the form, use something
like:

Forms!YourFormName!cboYourComboboxName

Note that this uses the bound column's value, not what is displayed. If
your underlying table is using a "lookup" data type, all bets are off!

Good luck

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
D

Dirk Goldgar

J Austin said:
I have a combo box that opens a macro "After Update". The macro opens a
selection query. I have tried to put the combo box selection in the
selection critieria of the field being filtered, but get a dataset with no
selections. I created the following code from the Expression Builder.
I've
tried to find the proper syntax but have not found a direct reference on
how
to capture combox selections.

[Forms]![Interface_Form_Cities]![Combo2].[City_Name].[AfterUpdate]


You're trying to use the combo box as one of the criteria for the query? If
the name of the combo box is "Combo2", then I would expect your criterion to
be just:

[Forms]![Interface_Form_Cities]![Combo2]

Did you try that?
 
J

J Austin

Jeff and Dirk,

Just tried [Forms]![Interface_Form_Cities]![Combo2] and got the same result
- the macro opens the query and the table display without any records
selected.

I ran the query without any selection criteria and I get all the records
displayed.

Thanks for the suggestion and any additional ideas.


Dirk Goldgar said:
J Austin said:
I have a combo box that opens a macro "After Update". The macro opens a
selection query. I have tried to put the combo box selection in the
selection critieria of the field being filtered, but get a dataset with no
selections. I created the following code from the Expression Builder.
I've
tried to find the proper syntax but have not found a direct reference on
how
to capture combox selections.

[Forms]![Interface_Form_Cities]![Combo2].[City_Name].[AfterUpdate]


You're trying to use the combo box as one of the criteria for the query? If
the name of the combo box is "Combo2", then I would expect your criterion to
be just:

[Forms]![Interface_Form_Cities]![Combo2]

Did you try that?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Dirk Goldgar

J Austin said:
Jeff and Dirk,

Just tried [Forms]![Interface_Form_Cities]![Combo2] and got the same
result
- the macro opens the query and the table display without any records
selected.

I ran the query without any selection criteria and I get all the records
displayed.

Thanks for the suggestion and any additional ideas.


What is the SQL of the query you're opening?

What is the SQL of the RowSource query for the combo box, and what is its
BoundColumn property?

What is the data type of the field in the table, to which this criterion is
being applied?
 
J

J Austin

Dirk,

Very interesting, when I went to get the SQL code it had an "AND" and the
old code I had previously deleted. When I opened up the criteria using the
Expression Builder it was not there, only when looking at the SQL. I deleted
and erroneous code in the SQL view and it works. Sure don't understand how
that code stayed when it was deleted in the Expression Builder.

Thanks for the help,

Dirk Goldgar said:
J Austin said:
Jeff and Dirk,

Just tried [Forms]![Interface_Form_Cities]![Combo2] and got the same
result
- the macro opens the query and the table display without any records
selected.

I ran the query without any selection criteria and I get all the records
displayed.

Thanks for the suggestion and any additional ideas.


What is the SQL of the query you're opening?

What is the SQL of the RowSource query for the combo box, and what is its
BoundColumn property?

What is the data type of the field in the table, to which this criterion is
being applied?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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