Not empty recordset?

J

Jules DiMarco

I understand that you can use the following code to check
whether a dataset is empty:

If rstRecordset.BOF And rstRecordset.EOF

But how do you check whether a recordset is not empty?

I've tried doing a recordcount but get an error when
attempting to move the last record if the recordset is
indeed empty!
 
M

Marshall Barton

Jules said:
I understand that you can use the following code to check
whether a dataset is empty:

If rstRecordset.BOF And rstRecordset.EOF

But how do you check whether a recordset is not empty?

I've tried doing a recordcount but get an error when
attempting to move the last record if the recordset is
indeed empty!


Another way is to check if the recordset has at least one
record:

If rstRecordset.RecordCount > 0 Then
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top