1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

VB6 / MYSQL problem using "seek"

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

  1. nlgootee

    nlgootee New Member

    Mar 28, 2013
    Likes Received:
    Trophy Points:
    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.
           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:
        Dim cnFind As ADODB.Connection
        Set cnFind = New Connection
        cnFind.CursorLocation = adUseServer
        cnFind.ConnectionString = "DSN=MYFLOURISH"
        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

    Jul 12, 2004
    Likes Received:
    Trophy Points:
    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