Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to deal with EOF and BOF???

Status
Not open for further replies.

jinglin

MIS
May 4, 2004
72
US
There're two command buttons on my form called Previous Record, Next Record in order to navigate the records( I didn't use ADO or DAO recordsets). When I keep clicking on the buttons, I'll encounter an error msg saying that " You can't go to the specific record. You might be at the end of the record.", Is there a way that I can detect EOF or BOF to alert the users?

Thanks for your help in advance.

Jinglin
 
I seldom use the .bof/.eof for that, but just trap for the 2105 in the error trapping routine:

[tt]myexit:
exit sub
myerr:
if (err.number = 2105) then
msgbox "alredy at first/last..."
else
msgbox err.description
end if
resume myexit
end if[/tt]

Roy-Vidar
 
Thank you very much! It solved my problems.
Jinglin
 
Wouldn't it be better to start the OnClick event of the button with:

If Not rs.EOF
...
End If

and prevent the error rather than let the error occur and then trap it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top