Results 1 to 3 of 3

Thread: DBCombo - SelectedItem

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 1999
    Posts
    1

    Post

    DBCombo's click event has the following code:
    Data1.Recordset.bookmark & _
    = dbcombo1.selecteditem

    but it gives an error : Object doesn't support this property or method (Error 438)

    please state why.

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    It happens because you have DataCombo bounded to a specific field of your data control. It means that it shows only one record at a time. I usually use regular combo box to do the navigation. In a example below I'm using Northwind database that comes with VB, so the field I'm using is CompanyName.

    Put this code on Form_Activate event:

    Code:
        Do Until Data1.Recordset.EOF
            Combo1.AddItem Data1.Recordset.Fields(1)
            Data1.Recordset.MoveNext
        Loop
        Data1.Recordset.MoveFirst
        Combo1.ListIndex = 0
    Then put this line on Combo1_Click event:


    Data1.Recordset.FindFirst "[CompanyName]='" & Combo1.List(Combo1.ListIndex) & "'"


    Hope this helps.
    Regards,



    ------------------

    Serge

    Software Developer
    [email protected]
    [email protected]



  3. #3
    New Member
    Join Date
    Jan 1999
    Location
    Cleveland,Ohio,USA
    Posts
    6

    Post

    Please, check how dbcombo is connected to Data control. I used RowSourse = Data1 and ListField = some field in the recordset.
    I used this procedure:
    Private Sub DBCombo1_Click(Area As Integer)
    Data1.Recordset.Bookmark _
    = DBCombo1.SelectedItem
    End Sub
    And it works perfect.

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