How to prevent EOF and BOF erros

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi. I have some external applications running over my access databases.

Sometimes some queries has no registers to show up.

In this cases I would like to insert a logical record in order that the
recordser count would be one.

It could be something as put a text into a field.

Is it possible?

Regards,

Marco
 
You could test for a recordset as follows:

with rst
if not .bof and not .eof then
now you know you have a minimum of one record
else
no records so do something here...
end if
end with

hth
 
You would put this in a form (open event). You will do the check to see if
the recordset returns any records.

Could look something like this:

Dim rst as ADODB.Recordset
set rst=new ADODB.Recordset

rst.open "query", currentproject.connection

if not rst.bof and not rst.eof then
'- >records found
'- apply the action you'd want
else
'-> no records found
'->apply action
end if

rst.close
set rst=nothing

hth
 
Back
Top