VB6 / MYSQL problem using "seek"

Discussion in 'Visual Basic ( VB )' started by nlgootee, Mar 28, 2013.

  1. nlgootee

    nlgootee New Member

    Joined:
    Mar 28, 2013
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I use the following code in the change event of a vb6 textbox and load the result into a listbox. This is using DAO in an ACCESS database. It has worked great since 1994.
    Code:
           Dim sFind As Variant
               sFind = txFind.Text
           If Len(SFind) > 0 Then
                MousePointer = 11
                Findmark = g_rsC.Bookmark
                g_rsC.Index = "LAST NAME"
                   g_rsC.Seek ">=", sFind
                If g_rsC.EOF Then
                       g_rsC.Bookmark = Findmark
                       txFind.Text = ""
                End If
            End If
    
    We are switching to ADO in a MYSQL database and I converted the code to:
    Code:
        Dim cnFind As ADODB.Connection
        Set cnFind = New Connection
        cnFind.CursorLocation = adUseServer
        cnFind.ConnectionString = "DSN=MYFLOURISH"
        cnFind.Open
    
        Dim rsFind As ADODB.Recordset
        Set rsFind = New Recordset
        Dim sFind As Variant
        sFind = txFind.Text
        With rsFind
            .CursorLocation = adUseServer
            .ActiveConnection = cnFind
            .Source = "Customer"
            .Index = "LAST NAME"
            .Seek ">=", sFind
            .CursorType = adOpenKeyset
            .LockType = adLockOptimistic
            .Open Options:=adCmdTableDirect
        End With
    
    When I run it, I get a type mismatch error as soon as I type the first letter. I don't know if it is an ADO error or a MYSQL error. If anyone can help me out here, I would really appreciate it. TIA
     
    Last edited by a moderator: Mar 29, 2013
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    You don't need to create the same thread in VB as well as MySQL forum and I have deleted your other thread.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice