Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Posts
    4

    Unanswered: Combo Box VB script

    I am having problems getting a value from a combo box which is populated by a query.

    Row Source for the combo box:

    "SELECT rparts.Description, rparts.ID FROM rparts; "

    Where rparts is a query and Description and ID are fields in the query.

    In the code I do the following:

    Dim rst As Recordset
    Set rst = comLocation.Recordset
    Get_comLocation = CLng(rst!ID)

    Where comLocation is the combo box.
    Get_comLocation is the function name - it returns the ID. What I'm trying to do is retrieve the ID associated with the description selected in the combo box. I think my problem has to do with a null value in the combo box, but when I try to retrieve that value I get errors about not being able to do that with query type row sources (it asks for value types).

    Any ideas?

    Thanks,
    TG

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    What code are you using to retrieve the value from the ComboBox?

  3. #3
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    421
    Sorry to be harsch but your going at this all wrong....

    I am hoping that you put into the combobox that it has 2 fields and that field 2 is the bound field

    If so you can simply fetch the value by saying

    Me.ComboBoxName

    If you didnt do the bound thing

    me.ComboBoxName.Column(1)
    0 would be the first column.

    Regards

Posting Permissions

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