How to recognise zero records after filtering subform?

A

Allen_N

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.
 
Top