PDA

Click to See Complete Forum and Search --> : ADO Find Problem


Rusty
Apr 1st, 2000, 09:17 AM
I'm using ADO with access97 database file. I've read bits and pieces on the find command but I can only get it to work on a few fields. I would like to allow the user to select the field to search on, use wildcards, and the direction. I keep getting arguments are out of range.

S$ = Search.Combo1
SearchText$ = Search.Text1

fMainForm.TData1.Recordset.MoveFirst
fMainForm.TData2.Recordset.MoveFirst

fMainForm.TData1.Recordset.Find S$ & "Like" & "'" & SearchText$ & "*'"

If fMainForm.TData1.Recordset.EOF Then
MsgBox "Not Found", vbOKOnly
fMainForm.TData1.Recordset.MoveFirst
fMainForm.TData2.Recordset.MoveFirst
Else
MsgBox "Found", vbOKOnly
End If

The user selects the field from a combo control and then enters a search string.

Any help would be greatly appreciated,

Rusty

Elias
Apr 2nd, 2000, 11:14 AM
Check your spaces in your SQL Statement

fMainForm.TData1.Recordset.Find S$ & "Like " & "'" & SearchText$ & "*'"

Notice the space after the word like...

-Elias

Rusty
Apr 3rd, 2000, 05:16 AM
Thanks,

That worked great!!

Rusty