Consulting

Results 1 to 3 of 3

Thread: Solved: Variable Bound Columns in a Combo/List box?

  1. #1
    VBAX Tutor
    Joined
    Mar 2005
    Posts
    204
    Location

    Solved: Variable Bound Columns in a Combo/List box?

    When you click on a row in a combo/list box, the data in the first row is (by default) the data "Returned".

    This can be changed during design time, but, naturally

    I want to choose the bound column during run time.

    Or, perhaps to choose data in several columns...to use in subsequent operations.

    Any Suggestions?

  2. #2
    VBAX Tutor
    Joined
    Mar 2005
    Posts
    204
    Location
    "Almost" Solved

    Define Col as integer in General...a Global Value

    In Form Load, Col = 1

    In a Command, option, or whatever button,

    Col = Col + 1
    If Col > (number of columns in combo box) Then col = 1
    Combox.BoundColumn = Col
    .
    .
    .

    When the form loads the combo box opens with the bound column at column 1. When the command/option or whatever is clicked, mouse-downed...
    the combo box when NEXT clicked will return the data in Column2...etc.

    You can have a text box display the bound column number, or the data returned by the box.

    But it seems very "Hacky"!

    mud2

  3. #3
    Moderator VBAX Master geekgirlau's Avatar
    Joined
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,464
    Location
    Normally you would use the Column property to return data from other columns (ie the following code gives you the data from column 3 of the combo box).

    [VBA]
    strCustomer = me.cboTest.Column(2)
    [/VBA]

    Is there any reason this method won't work for you?

Posting Permissions

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