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.
We are switching to ADO in a MYSQL database and I converted the code to:
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
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
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
Last edited by shabbir; 29Mar2013 at 09:04.. Reason: Code blocks