Is this Count the number of records in the subform?
--
Dave Hargis, Microsoft Access MVP
:
Okay this is a bit different that what I first read.
When you do this search, what are you search on? The form's recordsset, the
subform's recordset, a table, a query? There appears to be more to it than I
am understanding. Can you describe in some detail what you are doing, please.
--
Dave Hargis, Microsoft Access MVP
:
=Nz(Count([SPONNAME]), 0)
The Nz will return vbNullString if no parameter is included..
--
Dave Hargis, Microsoft Access MVP
:
I have an unbound field on a search form titled SponsorCount -
=Count([SPONNAME])
When a search is completed, and there are no results returned,
SponsorCount is left blank, but when there are, it of course returns
the number of results (i.e. "67").
How can I get it to return a zero if there are no results?
Thanks in advance!
magmike
Himagmike,
Try using the Nz function, it would look like this
'=Nz(Count([SPONNAME]))' or even '=Count(nz([SPONNAME])), hope this
helps.
Nick- Hide quoted text -
- Show quoted text -
None of these are working! Does it make any difference that the field
and the results are on a subform, but the unbound search field and
search command button are on the parent form?
It still shows the correct count when it is above zero, however.- Hide quoted text -
- Show quoted text -
The parent form does not have a record source. The parent form houses
three different subforms that each are driven by queries that access
different data sources (tables). As part of the search criteria, the
user selects the data source they are using and the proper subform is
made visible and used for the search.
Each subform uses a simple query that is used primarily to isolate the
necessary fields and for sorting.- Hide quoted text -
- Show quoted text -
It should also be noted, that the unbound field housing the count
code, is on each subform to count the results- Hide quoted text -
- Show quoted text -