Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Posts
    52

    Unanswered: Control source combobox

    I have a combobox that is populated at runtime (it needs to be because I use variables in it) from a query, when the form loads.

    The combobox contains two fields, a number (not shown, size 0) and the text.

    When the form displays, it shows the combobox with the default selected (blank). The combobox has the limitedtolist property set to True

    However, I want to choose one of the items in the list to be selected.
    I asume I should do this with the controlsource property of the combobox. But, this controlsource can not be taken directly from a table, but rather from two variables (two because my combo has 2 columns).

    How should I do this?

    All help appreciated,

    Philip

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

    Re: Control source combobox

    Originally posted by ptrapp
    I have a combobox that is populated at runtime (it needs to be because I use variables in it) from a query, when the form loads.

    The combobox contains two fields, a number (not shown, size 0) and the text.

    When the form displays, it shows the combobox with the default selected (blank). The combobox has the limitedtolist property set to True

    However, I want to choose one of the items in the list to be selected.
    I asume I should do this with the controlsource property of the combobox. But, this controlsource can not be taken directly from a table, but rather from two variables (two because my combo has 2 columns).

    How should I do this?

    All help appreciated,

    Philip
    MyCombobox.Value= XXXXXXXX

    This will set the combobox to the row of the matching bound column ...

  3. #3
    Join Date
    Mar 2004
    Posts
    52
    Thank you!!! I was looking way too far.


    Just a small remark:
    If I put the rowsource to this table:
    1 a
    2 b
    3 c
    1 d

    and I set the combo.value=1, it will point to the first record (item in the combo). So, in this manner you can't put the combo on the "d" field (by working with numeric field as selector). So, in this case, you need to specify a combination for the value field (how???).

    Greetz,

    Phil

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Originally posted by ptrapp
    Thank you!!! I was looking way too far.


    Just a small remark:
    If I put the rowsource to this table:
    1 a
    2 b
    3 c
    1 d

    and I set the combo.value=1, it will point to the first record (item in the combo). So, in this manner you can't put the combo on the "d" field (by working with numeric field as selector). So, in this case, you need to specify a combination for the value field (how???).

    Greetz,

    Phil
    Phil,

    This gets back to the "Bound Column" ... If you make the bound column = 2 then you'd put a value of "d" to select that row ... Keep in mind that Bound Column has nothing to do with what is visible ...

Posting Permissions

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