Recorset

  • Thread starter Thread starter Ray
  • Start date Start date
R

Ray

Hello All,

I have a recordset that is populated with a SQL statement

How do I determine if the SQL returns records before
populating the recordset? I tried populating the recordset
and then using FindFirst and NoMatch but still I get at
3021 error on the findfirst line.

How can I determine if any records are returned before the
recordset is populated?

I could used the recordcount property but I'm afraid the
if I don't use the .movelast I will not have an accurate
record count.

Please help. I'm about to scratch a hole in my head.

Thanks,
Ray
 
Ray said:
Hello All,

I have a recordset that is populated with a SQL statement

How do I determine if the SQL returns records before
populating the recordset? I tried populating the recordset
and then using FindFirst and NoMatch but still I get at
3021 error on the findfirst line.

How can I determine if any records are returned before the
recordset is populated?

I could used the recordcount property but I'm afraid the
if I don't use the .movelast I will not have an accurate
record count.

Please help. I'm about to scratch a hole in my head.

Thanks,
Ray

To find out if any records are returned, you have to open the recordset.
Once you've done so, you can test the recordset's EOF property to see if
it's empty. (Note: although the general rule is to check if *both*
..EOF and .BOF are true, if you've only just opened the recordset you
really only need to test one of them.) Or for most (all?) DAO
recordsets can safely test to see if the .RecordCount property is zero.
If it's not zero, you have at least one record, even though the count is
not accurate yet.
 
Thanks Dirk. That makes perfect sense. I'll see if the
recordset.count = 0 before proceeding.

Ray
 
Back
Top