Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    build combo box programmatically (97 sr2)

    Trying to build a form on-the-fly based on information stored in a control table. For the combo box, I want to hide the first column and display the second column. If I were creating the combo manually, I would enter the following into the Column widths Property: 0";2";3"

    Here is a code snippet where the combo is created:

    With frm.Controls("combo" & intComboCounter)
    .ControlSource = rst!FieldName
    .RowSource = rst!RowSource
    .ColumnCount = rst!ColumnCount
    .ColumnWidths = rst!ColumnWidths '********* here ****
    .ColumnHidden = False
    .ColumnWidth = rst!fieldwidth
    .ListWidth = 3 * .ColumnWidth
    .ColumnOrder = intCounter
    End With

    The rst!ColumnWidths field is Text, and I've tried the following permutations:
    0";2";3"
    0;1500;1500 (valid .ColumnWidth values are in this range!)
    0,2,3
    0;2;3
    etc

    In all cases, the item displayed is column #1 even though I've entered a zero for the first column width. What do I enter into the ColumnWidths field to hide the first column of the combo?

    Thanks.
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

  2. #2
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Emerald Beach, New South Wales, Australia
    Posts
    126
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: build combo box programmatically (97 sr2)

    Is rst!ColumnCount equal to 3?

  3. #3
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: build combo box programmatically (97 sr2)

    If you are using the inches as unit of measurement the ColumnWidths setting should read like this:
    <pre>Me.Combo2.ColumnWidths = "0 in;2 in;3 in" </pre>

    HTH

  4. #4
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: build combo box programmatically (97 sr2)

    thanks Mark. that worked. also turns out that measurements in Twips works, too (0;1400;2880)

    However, the real culprit in this case was database corruption. Your suggestion did not work initially. Then I repaired and compacted the database, and it magically worked properly. Gotta remember those details when thing go strange...

    Thanks
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

Posting Permissions

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