This is for a command button array but i have a problem in the quoted text, the error Expected End of Statement, i am learning from a book, i guess there is some problem in typing the code. Please somebody resolve my problem!
Dim BookMark1 As Variant
'Mark your place in case no match is found
BookMark1 = dtaTitles.Recordset.Bookmark
'Move to top of table to start search
dtaTitles.Recordset.MoveFirst

dtaTitles.Recordset.Find "Author >= '" + cmdLetter(Index).Caption + "'", 0, adSearchForward
If dtaTitles.Recordset.EOF = True Then
dtaTitles.Recordset.Bookmark = BookMark1
End If
txtAuthor.SetFocus

Recommended Answers

Hi
Does it highlight where the end of statement is expected?

Also do you handle if cmdLetter(index) is out of bounds?

Jump to Post

All 4 Replies

Hi
Does it highlight where the end of statement is expected?

Also do you handle if cmdLetter(index) is out of bounds?

Try

dtaTitles.Recordset.Find("Author >= '" & cmdLetter(Index).Caption & "'", 0, adSearchForward)

It would also help if you specify what version of VB you are using. In my version (2010), Variant is not a valid type. You should be using "&" for concatenation rather than "+". And finally, instead of

If dtaTitles.Recordset.EOF = True Then

you can use

If dtaTitles.Recordset.EOF Then

i used vb6 because i am just learning now, so i want to start with the first vb program.
Thanks "Reverend Jim" I succedded but i just changed something since it gave me another error, i did not put the (..) around the code, cause its telling me to put an "="

G_Waddell, yes it does highlight, its till here :
dtaTitles.Recordset.Find "Author >= '" +
cmdLetter(Index).Caption + "'", 0, adSearchForward
I succedded, Thanks anyway for trying to solve my problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.