Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2003
    Location
    Belfast, UK
    Posts
    87

    Unanswered: combobox text to number in table

    Hi,

    What I want to know is how i can show a text string in a combobox on a form but a have a numerical value on the table.

    combobox values are all listed in tables each having a numeric primary key. any ideas?

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: combobox text to number in table

    Originally posted by bertthefreak
    Hi,

    What I want to know is how i can show a text string in a combobox on a form but a have a numerical value on the table.

    combobox values are all listed in tables each having a numeric primary key. any ideas?
    Can you rephrase your question? If you have multiple columns in you combobox then all you need to do is cast the value of the column to the appropriate type ...

  3. #3
    Join Date
    Dec 2003
    Location
    Belfast, UK
    Posts
    87
    basically.

    there are two columns in table1 (combobox source)
    column1 - numerical (primrary key)
    column2 - text (visible value on form)

    table2 - data store
    column1 - numerically value (primrary key)
    column2 = column1 from table1

    I want the user to only be able to see the text value on the form not the string.

    Any time I've tried it I keep getting value not valid for this field.

    I tried adding a section to the afterupdate on the combobox to something like.

    intvalue = (me!combobox.value = table1.column1)

    table2.column2 = intvalue.

    but I couldn't get it working.

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Originally posted by bertthefreak
    basically.

    there are two columns in table1 (combobox source)
    column1 - numerical (primrary key)
    column2 - text (visible value on form)

    table2 - data store
    column1 - numerically value (primrary key)
    column2 = column1 from table1

    I want the user to only be able to see the text value on the form not the string.

    Any time I've tried it I keep getting value not valid for this field.

    I tried adding a section to the afterupdate on the combobox to something like.

    intvalue = (me!combobox.value = table1.column1)

    table2.column2 = intvalue.

    but I couldn't get it working.
    I'm not following your code ... To hide a column on a combobox just set it's width to 0. To fill a combobox from a table you need to set either its RowSource or ControlSource ... To get a value from a combobox that is not the bound column (visible or not) you need to use the Column property Ex: MyCombobox.Column(XXX,MyCombobox.ListIndex)

  5. #5
    Join Date
    Dec 2003
    Location
    Belfast, UK
    Posts
    87
    I'm newish, so forgive any lack of understanding, how would I use that function?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •