Combo box

J

jhsb4mrgn

I am making a tabular form. In the form I have a combo box for the customer.
It shows the name but I would also like it to show the address, city, state,
and zip.

Also would I be able to display it in the form like this:
ABC Business
123 Main St
Anywhere, IL 55555

Thanks
 
K

Ken Sheridan

For the combo box's RowSource use something like the following:

SELECT Customer, Address, City, State, Zip
FROM YourCustomersTableOrQuery
ORDER BY Customer;

Set the control's BoundColumn property to 1, its ColumnCount property to 5,
its ColumnWidths to something like 3cm;3cm;3cm;1cm;2cm (experiment for the
best fit – you can of course use inches), and its ListWidth to 12cm (i.e. the
sum of the ColumnWidths). If you want to hide any of the columns set the
ColumnWidth for that column to 0cm.

Below the combo box add four unbound text boxes for Address, City, State and
Zip positioned as you wish, with ControlSources which reference the combo box
like so (note that the Column property is zero-based so Column(1) is the
second column and so on).

=cboCustomer.Column(1)
=cboCustomer.Column(2)
=cboCustomer.Column(3)
=cboCustomer.Column(4)

These controls will still show the relevant value if the referenced column
is hidden in the combo box's list.

Ken Sheridan
Stafford, England
 
J

jhsb4mrgn

Thanks for the fast reply. Now I have a issue with the unbound boxes part.
I put the controlsource to reference the combo box then = a column like you
said and it returns #Name?. The combo box is working like you said it
would, showing 5 columns with the different information in it, but only
putting the customer name in the combo box.

In the unbound boxes, either I'm putting the information in the wrong spot
or typing it out wrong, but using the unbound boxes is getting me closer to
what I'm trying to accomplish.

Thanks again
 
K

Ken Sheridan

Make sure you've got the name of the combo box right in the ControlSources of
each unbound text box. You'll find it as the Name property in the combo
box's properties sheet. The as each ControlSource property for the unbound
text boxes enter an = sign followed by the name of the combo box followed by
a full stop (period) followed by Column(#), entering 1, 2 etc for # as
appropriate. Access will wrap the names in brackets so it should look like
this for the first one:

=[NameOfThe ComboBox].[Column](1)

Ken Sheridan
Stafford, England
 
J

jhsb4mrgn

Thanks a million it works perfect. I was typing it in wrong, but thanks for
clearing it up for me.

Thanks
jhsb4mrgn

Ken Sheridan said:
Make sure you've got the name of the combo box right in the ControlSources of
each unbound text box. You'll find it as the Name property in the combo
box's properties sheet. The as each ControlSource property for the unbound
text boxes enter an = sign followed by the name of the combo box followed by
a full stop (period) followed by Column(#), entering 1, 2 etc for # as
appropriate. Access will wrap the names in brackets so it should look like
this for the first one:

=[NameOfThe ComboBox].[Column](1)

Ken Sheridan
Stafford, England

jhsb4mrgn said:
Thanks for the fast reply. Now I have a issue with the unbound boxes part.
I put the controlsource to reference the combo box then = a column like you
said and it returns #Name?. The combo box is working like you said it
would, showing 5 columns with the different information in it, but only
putting the customer name in the combo box.

In the unbound boxes, either I'm putting the information in the wrong spot
or typing it out wrong, but using the unbound boxes is getting me closer to
what I'm trying to accomplish.

Thanks again
 

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

Similar Threads


Top