Combo Box Search

G

Guest

I have a form that is pulling from a query to populate it. I am trying to use
a combo box to search by lastname and pull all other record information on
the form. I use the wizard to create the combo box using last name as the
search criteria. Then I go to the properties of the combo box and into the
Row Source and modify the select query to concatenate the LastName and the
FirstName. Then when I go to my form it will not change the information on
the form when I select different LastName and First name it will not display
the new selection.

Can someone please help?
 
R

Rick Brandt

Moses said:
I have a form that is pulling from a query to populate it. I am
trying to use a combo box to search by lastname and pull all other
record information on the form. I use the wizard to create the combo
box using last name as the search criteria. Then I go to the
properties of the combo box and into the Row Source and modify the
select query to concatenate the LastName and the FirstName. Then when
I go to my form it will not change the information on the form when I
select different LastName and First name it will not display the new
selection.

Can someone please help?

Well the CODE that the wizard created is still looking for a match on last name
only and you have changed it so that what the ComboBox contains is something
that it will never find.

Instead of changing the bound column to include first and last name you need to
leave it alone, but add a second column that combines them. Then make the width
of the bound column zero so you don't see it.
 
G

Guest

Thanks for the feedback however, I don't understand what you mean when you
say set the bound with to zero. Can you explain it to me like I'm a 2 year
old. Also would you happen to know how to keep the combo box current when the
data changes.
 
G

Guest

Hi Moses,

Perhaps you will find this article helpful:

Combo box to find a record
http://www.access.qbuilt.com/html/find_a_record.html


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________

:

I have a form that is pulling from a query to populate it. I am trying to use
a combo box to search by lastname and pull all other record information on
the form. I use the wizard to create the combo box using last name as the
search criteria. Then I go to the properties of the combo box and into the
Row Source and modify the select query to concatenate the LastName and the
FirstName. Then when I go to my form it will not change the information on
the form when I select different LastName and First name it will not display
the new selection.

Can someone please help?
 
R

Rick Brandt

Moses said:
Thanks for the feedback however, I don't understand what you mean
when you say set the bound with to zero. Can you explain it to me
like I'm a 2 year old. Also would you happen to know how to keep the
combo box current when the data changes.

A ComboBox can have multiple columns in its RowSource. Only one of these
columns is the "bound column". This is the column whose value is picked up by
the ComboBox after a selection is made. When a ComboBox has more than one
column you can use the ColumnWidths property to control how wide the columns
will appear when the list is dropped down. This is a semi-colon separated lists
of values. For example, to have the first column be 1/2 inch wide and the
second be 1 inch wide you would make an entry of...

0.05";1"

Further to this, one can completely hide a column by using the same ColumnWidth
property and setting the width of the column to zero.

I'm assuming that you used the wizard to search for records by last name and
that it worked except that in the drop down list you want to see both the first
and last name. To do this you can add a second column that contains both first
and last name to the query and by changing the ColumnCount property of the
ComboBox to 2.

At this point the ComboBox will still work, but you will now see two columns in
the list, one with just the last name and one with both first and last name.
You can then set the ColumnWidths property to...

0.0";1"

Now the first column (the bound column that the code is using) is no longer
visible, but it is still there and the code will still work. All you have
changed is what the user sees.
 

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