Results 1 to 5 of 5

Thread: Datacombo doubt

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 1999
    Location
    Avinashi, TamilNadu, India
    Posts
    20

    Post

    I'm using Visual Basic 6.0(SP3). I bound it to a ADODB Recordset. Both ListField and BoundColumn were bound to two fields of the Recordset. Assume, there are more than 50 items in the list. If I type some characters in the DataCombo,the Matching Item not get scrolled. Also ,If I assign value for BoundText , the Correct Item is not appearing in the Text Portion of DataCombo. If there ars less than 50 items everything works fine. Is there any API function to solve this Problem? Thanks for any Help.

  2. #2
    New Member
    Join Date
    Nov 1999
    Posts
    8

    Post

    I've a weird problem too:
    I bind the datacombo to a DataEnvironment command that returns a recodset (5 - 10 records in it).
    ListField is bound to recordset!Description and BoundColumn is bound to recordset!ID_num.
    The list fills oK, but when I ask what is the BoundText, I get the text (whatever is in the Description field) not the ID_num ????
    How could I list a description, but use a number ID in a simple way? (I thought the datacombo should do it
    Thanks.
    Mocoo.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Dec 1999
    Location
    Avinashi, TamilNadu, India
    Posts
    20

    Post

    When I bound it to a DataEnvironment Command object everything is working fine. I didn't meet a problem as you told.

  4. #4
    New Member
    Join Date
    Feb 2000
    Posts
    10

    Post

    You will have to put code in Change event track the keys pressed and set Listindex property of that combo box with that number

  5. #5
    Addicted Member Vitani's Avatar
    Join Date
    Jul 2001
    Location
    England
    Posts
    134

    Re: Datacombo doubt

    5 years, and 3 service packs later, and I'm getting this bug now. There seems to be nothing on the internet about it, other than open-ended forum & newsgroup threads. Has anyone ever solved this riddle?

    To recap - if you have >50 items in a bound DataCombo control, and you try to set the BoundText property to any item with an index above 50, it does not work (the BoundText = ""), it works fine for all indexes below 50.

    my code is this:

    VB Code:
    1. ' For reference, any rsToUSe that is passed to this method is a Private ADODB.Recordset on the Form with the DataCombo on it
    2.  
    3. Private Sub PopulateList(ByVal TableName As String, ByRef cmb As DataCombo, ByRef rsToUse As ADODB.Recordset, Optional ByVal ColumnToDisplay As String = "Description", Optional ByVal ColumnToStoreInTable As String = "Code", Optional ByVal OptionalSQL As String)
    4. ' This Sub fills a Record Set (rsToUSe) with the two selected columns (strColumnToDisplay and
    5. ' strColumnToStoreInTable) from a table (dbTable) and then uses the Record Set to populate a
    6. ' DataCombo box (cmbBox) with the values in the Table
    7.  
    8.     Set rsToUse = New ADODB.Recordset
    9.     rsToUse.CursorLocation = adUseClient
    10.     rsToUse.Open "SELECT [" & ColumnToStoreInTable & "], [" & ColumnToDisplay & "] FROM [" & TableName & "] " & OptionalSQL, fmMain.conn, adOpenStatic, adLockReadOnly
    11.     Set cmb.RowSource = rsToUse
    12.     cmb.ListField = ColumnToDisplay
    13.     cmb.BoundColumn = ColumnToStoreInTable
    14.     ' x is defined elsewhere
    15.     cmb.BoundText = x ' setting the BoundText reports no error if x is an item > index 50, it just remains ""
    16.     cmb.MatchEntry = dblExtendedMatching
    17.  
    18. End Sub
    If you can dream it, you can do it - Moo Power!

Posting Permissions

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



Click Here to Expand Forum to Full Width