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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

eof or bof error trap not working

Status
Not open for further replies.

VBVines

MIS
Jun 11, 1999
98
US
I have a search form that uses the selection from a combo box to populate text boxes on a form. When I try to update a text box (field in db), I get an eof/bof error. I try to use the old; if rs.eof = true then
rs.moveprevious
end if
even when the recordset is opened with the following

rs.Open Ssql, strcnn, adOpenKeyset, adLockOptimistic, adCmdText

It basically ignores my eof/bof error trap or gives me an error that says the provider doesn't allow this. I could do this with DAO but I am now trying to do everything in ADO.
Any help would be appreciated. I can't believe I couldn't find anyone else with a similar problem, I did a pretty good search and couldn't find anything here on this. aspvbwannab
 
If the recordset has no records the rs.MovePrevious will cause this.

You could use

if rs.EOF Then
If Not rs.BOF Then rs.MovePrevious
end if

However, if you are just iterating through the recordset I tend to use

While Not rs.EOF
' Do whatever
rs.MoveNext
Wend

Chaz
 
if u are using rs.moveprevious u have to use rs.Bof
and for rs.movenext u have to use rs.Eof

Here is my rs example

if not rs.bof then
while not rs.Eof
'put your code here
rs.movenext
wend
end if

or

if not rs.eof then
while not rs.bof
'put your code here
rs.moveprevious
wend
end if
Hope this helps ________

George
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top