David, Thanks for your help, but there's an easier way - provided to
me by a genius in another Access forum...(its probably not polite to
say here which forum...!) Following is his code not mine....
=========================
Replace
Count(QryComplaintSummary.RecordID)
with
Nz(Count(QryComplaintSummary.RecordID),0)
The Nz function returns its first argument but replacess null values
by the second argument. Usually, the result of Nz is text. If you need
numeric values for further calculations, use
CLng(Nz(Count(QryComplaintSummary.RecordID),0))
=============================
I'd never used the Nz function before - very handy. This worked a
treat and is very simple & elegant.
Thanks for the follow -up though - much appreciated.
dp
d.REMOVEschofield@blueyonder.co.uk (David Schofield) wrote in message news:<4117b0ef.745334354@localhost>...[color=blue]
> On 8 Aug 2004 23:46:47 -0700,
davidpeach@optusnet.com.au (David Peach)
> wrote:
>[color=green]
> >Hello, hope somebody here can help me... I have a query that lists
> >defects recorded in a user defined date range. That query is then used
> >as the source for a Cross Tab query that cross-tabs count of defect
> >type by calendar month. Defect types are stored in one table, defect
> >transactions in another along with date etc. When I cross-tab the
> >results, defect types that have no defects recorded against them
> >appear as a blank (null) value. That is, the zero value is suppressed.
> >Unfortunately, in the management reports that are produced, they (QA
> >Managers) want to see a Zero value, not a null value.[/color]
>
> Hi David
>
> There may be some simple way, but I think you need to run the crosstab
> on a query which already contains all the required table entries. For
> example you can form a cross product (all pairs month/defect) by a
> query "AllRequiredPairs" such as
>
> SELECT DefectTypes.DefectType, MonthsTable.mnth
> FROM DefectTypes, MonthsTable;
>
> (MonthsTable is just a list "Jan", "Feb", "Mar "etc)
>
> You can then form a query "Group1" which is the union of the required
> pairs with the actual defects which have occurred.
>
> SELECT DefectOccurrences.DefectType, Format([Complaint Date],"mmm")
> AS mnth, "actual defect"
> FROM DefectOccurrences
> UNION Select DefectType, mnth, "dummy entry" from
> AllRequiredEntries;
>
> (I have added the third unnamed column to the union to make sure that
> all records are unique otherwise it won't work. These two queries
> could be combined)
>
> Finally the crosstab can be something like
>
> TRANSFORM Count([DefectType])-1
> SELECT group1.DefectType FROM group1
> GROUP BY group1.DefectType
> PIVOT group1.mnth In
> ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug"," Sep","Oct","Nov","Dec");
>
> where the minus one removes the "dummy" required items.
>
> David[/color]