Qurey column field based upon a combo box entry

V

vcsphx

All,

I have a form with a combo box field with 14 entries in it and each entry
corresponds to a column name in a table. I have another report which is based
upon a query (datasource is the same table), with two fields...one
corresponds to what the user chooses from the combo box and the another one
would be just a filter based upon what the user enters in a text box and I
don't have problem with the later. What I want to achieve is whenever the
user chooses the entry from the combo box, the report should display only a
column corresponds to what the user chooses in the combo box along with the
other column that I am getting from the text box. Is there any easy way to do
it? Right now I am creating a recordset by selecting those two columns using
a SQL statement and storing that in a table and later getting my report based
upon the table. I know it's a complicated one and I hope you guys can provide
me an easy way to approach this. Thanks in advance!
 
M

Marshall Barton

vcsphx said:
I have a form with a combo box field with 14 entries in it and each entry
corresponds to a column name in a table. I have another report which is based
upon a query (datasource is the same table), with two fields...one
corresponds to what the user chooses from the combo box and the another one
would be just a filter based upon what the user enters in a text box and I
don't have problem with the later. What I want to achieve is whenever the
user chooses the entry from the combo box, the report should display only a
column corresponds to what the user chooses in the combo box along with the
other column that I am getting from the text box.


Use a line of code in the report's Open event:

Me.textbox2.ControlSource = Forms!theform.thecombobox
 

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