Bound combo - display a list

  • Thread starter Thread starter Matt Williamson
  • Start date Start date
M

Matt Williamson

This is probably simple, I'm just missing it. I have a form with a combobox
on it bound to a field in a table. Instead of it showing the list of table
fields, it is setting them up as records where I have to click the
recordsource buttons at the bottom to see the entries. How do I change it to
display all of them in the dropdown with only a single record? This is in
access97. The help files are rather cryptic regarding this to me.

TIA

Matt
 
I am not sure if I am following your problem. I hope
this helps. Try to create a table with only the
information you want in the drop-down box. Do not use a
primary key in the table. Afterwards, go to the table
that is storing your data and change it to read the table
that is storing the information you want displayed in
your drop-down box. You will have to do the same thing
on any forms you have created using the old table.
 
Maybe it would help if I just describe what I'm trying to do and someone can
tell me the best way to achieve it.

What I have is a 2 column table setup like so

sales_office Description
000 House Accounts
001 Outside Accounts
002 Name1
...
088 Name20

I need to use data from the table in a query. I need for the combo to be
populated with the descriptions, but use the sales_office number for the
return criteria. Right now, for that query, I have the criteria set to
[Enter Sales office number] and it can be keyed in and works fine. Well,
there are multiple sales offices and if the user accidentally types the
wrong number, it will give inconsistant results. Also, they don't know the
sales office numbers for groups other than their own and have to look them
up. I figured if I have them choose it from a description they readily
understand it would be more accurate and prevent having to look them up
manually.

This is the first time I've used a combo box in Access97. I've done a lot of
VB6 programming and I'm used to the combo box in that environment. This one
isn't acting how I would expect it to.
 
Thanks Dan, that works well. I'm stuck on a couple things though

How do it get the form to only be 1 record. Right now I have the record
selector at the bottom displaying a record for each item in the combo. While
everything appears fine it just doesn't seem right.

Also, I notice that the listindex property is read only. How do I do the
equivalent of combo.listindex = 0 in VB? So the first Item in the list shows
up instead of it being blank.

TIA

Matt

Dan Artuso said:
Hi,
Make the record source for the combo box a query:
Select sales_office,Description From yourTable
Order By Description

Now on the property sheet for the combo,
set the column count to 2 and the bound colomn to 1.
Set the column widths to:
0";1"

Now the value returned by the combo will be sales_office
but it will display the the Description field.

--
HTH
Dan Artuso, Access MVP


Maybe it would help if I just describe what I'm trying to do and someone can
tell me the best way to achieve it.

What I have is a 2 column table setup like so

sales_office Description
000 House Accounts
001 Outside Accounts
002 Name1
..
088 Name20

I need to use data from the table in a query. I need for the combo to be
populated with the descriptions, but use the sales_office number for the
return criteria. Right now, for that query, I have the criteria set to
[Enter Sales office number] and it can be keyed in and works fine. Well,
there are multiple sales offices and if the user accidentally types the
wrong number, it will give inconsistant results. Also, they don't know the
sales office numbers for groups other than their own and have to look them
up. I figured if I have them choose it from a description they readily
understand it would be more accurate and prevent having to look them up
manually.

This is the first time I've used a combo box in Access97. I've done a lot of
VB6 programming and I'm used to the combo box in that environment. This one
isn't acting how I would expect it to.


Ty said:
I am not sure if I am following your problem. I hope
this helps. Try to create a table with only the
information you want in the drop-down box. Do not use a
primary key in the table. Afterwards, go to the table
that is storing your data and change it to read the table
that is storing the information you want displayed in
your drop-down box. You will have to do the same thing
on any forms you have created using the old table.
 
Back
Top