How to test for no data

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

Guest

I am trying to test for no data, so I can display an appropriate message when
there is no data. Also, I am currently getting an error, because I am trying
to set a variable, but there is no data.
 
I am trying to test for no data, so I can display an appropriate message when
there is no data. Also, I am currently getting an error, because I am trying
to set a variable, but there is no data.

Well, I guess you are doing this on a form.

Code the form's Open event:
If Me.RecordsetClone RecordCount = 0 Then
MsgBox "No records found."
Cancel = True
End If

If there is no data, the message will appear.
The form itself will not open.
Remove
Cancel = True
if you wish the form to open anyway, without records.
 

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

Back
Top