Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return "No Records" if Count([Field])=0

Status
Not open for further replies.

jaaret

Instructor
Jun 19, 2002
171
0
0
I'm using the Count function in the header of a continuous records sub-form to return the number of records. This works when there are records in the sub-form, however, if I go to a record in the main form and there aren't any records yet in the sub-form the field is displaying a blank rather than 0 (zero). I've tried the NZ and DCount functions but still am getting a blank. How do I get the field to display, "Zero Records" if there no records in the sub-form?
 
I came up with a workaround. I added a field to the main form that evaluates the field with Count([field]) on the sub-form using the IsNumeric function:

=IIf(IsNumeric([subform].[Form]![field])=0,"No Records",[subform].[Form]![field] & " Records")

This works for me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top