Combo Box based on a Query

S

Sandy Skaar

Good afternoon!

I need assistance for the following:

I have a query based on a table. In the query I have three
fields from the table combined into one field in the query.

I have a form with a combo box's row source based on the
above query field. The combo box is formatted to 3 columns
(one for each part of the field).

On the same form as above I have two text boxes (unbound).

When I choose a value for the combo box I need to populate
the first text box with the second column's data and the
second text box with the third column's data.

Please advise on the VB code needed to do this.

Thank you in advance for your help!

Sandy Skaar
Database Administrator
 
M

Marshall Barton

Sandy said:
I have a query based on a table. In the query I have three
fields from the table combined into one field in the query.

I have a form with a combo box's row source based on the
above query field. The combo box is formatted to 3 columns
(one for each part of the field).

On the same form as above I have two text boxes (unbound).

When I choose a value for the combo box I need to populate
the first text box with the second column's data and the
second text box with the third column's data.

The query need to contain the three fields:

SELECT fldA & fldB & fldC As Combined,
fldB, fldC
FROM thetable

Now the combo box actually has three fields to work with.
You can then set the other two text boxes to use expressions
like:

=thecombobox.Column(1)
and
=thecombobox.Column(2)

to display the second and third columns in the combo box.

I don't understand why you wuold want to concatenate teh
three fields together like that. You can easily display all
three fields by setting the combo box's ColumnWidths
property to display any one, two or all three columns.
 
S

Sandy Skaar

Marshall,

Thank you for your assistance. I wasn't sure if I could
refer to the column's in a combo box or not. I appreciate
your quick response!

Sandy Skaar
Database Administrator
 

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