Search a database table

A beginner asks

I am trying to search a database table called FLEET

The Field is called RegNo and I am getting a runtime error 3001 Invalid arguement at the following line
Recordset.FindFirst sCriteria

Can anyone show me where I am going wrong in the following code


Private Sub cmdSearch1_Click()
'Search RegNo field

Dim sCriteria As String
Dim sBkmark As String

Set Database = OpenDatabase(PathToDB)
Set Recordset = Database.OpenRecordset("SELECT * FROM Fleet")
   
sCriteria = Text1.Text

'remember where we were in case Search fails
sBkmark = Recordset.Bookmark

'Execute the find
Recordset.FindFirst sCriteria

'Check for success
If Recordset.NoMatch Then
    MsgBox "Record not found"
    'if failed return to last good record
    Recordset.Bookmark = sBkmark
    End If
    'Display the find in text box 6
    Text6.Text = Recordset!RegNo

End Sub
kennysAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jelliott720Commented:
Assuming RegNo is numeric try..

sCriteria = "RegNo = " & Text1.Text

if RegNo is a string..

sCriteria = "RegNo = '" & Text1.Text & "'"

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kennysAuthor Commented:
Many Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.