Hi to whoever has been good enough to read this.
I am very new to Visual Basic 6 and are trying to build a small data base program as part of a tutorial i managed to get my hands on.
I have been struggling with this problem in my code for too long now.

I would be gratefull if someone with some experience of these things, could take a look at this code and see if it contains any obvious problems. The error message says
runtime error 424 object required.
On debug this is highlighted in yellow.
txt.Author.SetFocus
Here is the code i think may be wrong.

Private Sub cmdLetter_Click(Index As Integer)
Dim BookMark1 As Variant
BookMark1 = dtaTitles.Recordset.Bookmark
If Index < 25 Then
dtaTitles.Recordset.FindFirst "Author >= '" + cmdLetter(Index).Caption + "' and Author < '" + cmdLetter(Index + 1).Caption + "'"
Else
dtaTitles.Recordset.FindFirst "Author >= 'Z'"
End If
If dtaTitles.Recordset.NoMatch = True Then
dtaTitles.Recordset.Bookmark = BookMark1
MsgBox "No " + Chr(Index + 65) + " Entries", vbOKOnly, "No Match Found"
End If
txt.Author.SetFocus
End Sub

Thank you.

Recommended Answers

All 4 Replies

replace txt.Author.SetFocus with txtAuthor.SetFocus I imagine your textbox is called txtAuthor and not txt.Author

commented: Good Job +5

Yes Yes it is indeed the problem. I cannot believe how stupid I was to miss it. Ive been searching for hours thank you very much for your help. It now runs perfect thats marvelous.

Good Job Hollystyles

Thanks again. If you would like to take a look at what ive done, it is published here http://www.andoverhydroponics.co.uk/BillsDataBaseTest.zip

This about the standard ive got to on a self teach basis. I would imagine its pretty simple stuff to most people here, but all the same I am chuffed with it and still working to make many much needed improvements. Bill

Be a part of the DaniWeb community

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