How to recognise zero records after filtering subform?

G

Guest

My code references a field in the selected record of a subform. However, if a
filter has returned no records to the subform, I get the error:

2427: "You entered an expression that has no value."

How can I determine that there are zero records after filtering the subform,
so that I can trap this condition?
 
A

Allen Browne

Try:
If Me.[Sub1].Form.RecordsetClone.RecordCount = 0 Then
replacing "Sub1" with the name of your subform.
 

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