f



Combo Box to List Box

I have a combo box that gets it's values from a table.  For example:

ID   Name
1    Book
2    Magazine
3    Novel

I have a list box that displays a list of records.  When the user adds
the record a want the list box to be updated with the values from my
fields including the combo box.  The problem is, the value of the
combo box (depending on the selection) is 1, 2, or 3 and that is what
is displayed in the list box.  I know it is an easy problem, but how
do I get the list box to display 'Book' instead of 1.
0
jrh04009 (2)
6/26/2003 2:08:00 PM
comp.databases.ms-access 42670 articles. 0 followers. Post Follow

3 Replies
914 Views

Similar Articles

[PageSpeed] 42

The default property .Value of the ComboBox is .Column(0) To refer to any of
the other columns use the index (zero based): Something like:

Me.TextBox = Me.ComboBox.Columns(1)

-- 
=================================================
Rich Harrington - Prairie State College MIS
      rharringN.0.$-P.@.m@covad.net
              http://www.dbko.com
=================================================
       you're gonna need a bigger boat...

-30-
"Jeremy R. Harner" <jrh04009@hotmail.com> wrote in message
news:1d0511ec.0306260607.21695e0e@posting.google.com...
> I have a combo box that gets it's values from a table.  For example:
>
> ID   Name
> 1    Book
> 2    Magazine
> 3    Novel
>
> I have a list box that displays a list of records.  When the user adds
> the record a want the list box to be updated with the values from my
> fields including the combo box.  The problem is, the value of the
> combo box (depending on the selection) is 1, 2, or 3 and that is what
> is displayed in the list box.  I know it is an easy problem, but how
> do I get the list box to display 'Book' instead of 1.


0
M5723 (12)
6/26/2003 3:57:11 PM
Depending on how developed your database already is a very simple
solution would be to remove the ID field as your primary key and just
set the Name field as your primary key.  I do that a lot for small
lookup tables like this because it removes at least one table out of
every query you build.

Just a suggestion.

jrh04009@hotmail.com (Jeremy R. Harner) wrote in message news:<1d0511ec.0306260607.21695e0e@posting.google.com>...
> I have a combo box that gets it's values from a table.  For example:
> 
> ID   Name
> 1    Book
> 2    Magazine
> 3    Novel
> 
> I have a list box that displays a list of records.  When the user adds
> the record a want the list box to be updated with the values from my
> fields including the combo box.  The problem is, the value of the
> combo box (depending on the selection) is 1, 2, or 3 and that is what
> is displayed in the list box.  I know it is an easy problem, but how
> do I get the list box to display 'Book' instead of 1.
0
freemans (3)
6/26/2003 7:03:01 PM
jrh04009@hotmail.com (Jeremy R. Harner) wrote:

>I have a combo box that gets it's values from a table.  For example:
>
>ID   Name
>1    Book
>2    Magazine
>3    Novel
>
>I have a list box that displays a list of records.  When the user adds
>the record a want the list box to be updated with the values from my
>fields including the combo box.  The problem is, the value of the
>combo box (depending on the selection) is 1, 2, or 3 and that is what
>is displayed in the list box.  I know it is an easy problem, but how
>do I get the list box to display 'Book' instead of 1.

You could have a keyword table. You'd have three records, the text
above, and would just run a SELECT name FROM table WHERE ID=
0
102334.12 (45)
6/27/2003 9:46:57 AM
Reply: