Results 1 to 3 of 3

Thread: ADO data control and Datagrid )oledb)

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 1999
    Posts
    39

    Post

    Can anyone help me with the followings:

    I am using ADO control and a Datagrid (OLEDB) grid in my project in VB6.

    I need to use a dropdown combo to display the customerid field. Once the user selects a particular customerid or types one in then I need to show the results in the grid.

    I can populate the combobox to display the list of customerid ie all records. But i cant get the grid to do find and go to that customerid which user selects in the combobox.

    How can i possibly achieve this ?

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

    Post

    This example uses Northwind database.

    Put this on Combo1_Click event:

    Code:
    Private Sub Combo1_Click()
        Adodc1.Recordset.Find ("CustomerID='" & Combo1.List(Combo1.ListIndex) & "'")
    End Sub

    If CustomerID in your database is a numberic field then use this:

    Adodc1.Recordset.Find ("CustomerID=" & Combo1.List(Combo1.ListIndex) & "")


    Since you have the DatGrid bounded to the AdoDC, it will jump to the record you select in the Combobox.

    Regards,

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

    Serge

    Software Developer
    Serge_Dymkov@vertexinc.com
    Access8484@aol.com
    ICQ#: 51055819


  3. #3

    Thread Starter
    Member
    Join Date
    Apr 1999
    Posts
    39

    Post

    Thanks Serge that works fine, thank 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
  •  



Click Here to Expand Forum to Full Width