Crosstab and nulls

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I have a crosstab which counts dates based on headings ie training types,
however this produces null values obviously where there aer no dates, not a
problem...

just wanted to ask if there was a way of substituing a null for a 0, sure i
can use the nvl function but not sure if this works in a cross-tab.....

any pointers appreciated...
 
Switch the crosstab in SQL View (View menu, from query design view.)

Add the Nz() function to the first line to specify a zero for null.

You will end up with something like this:
TRANSFORM Nz(Sum(Table1.Quantity),0) AS SumOfQuantity ...
 
I would add one other function to Allen's solution to correct for Nz()
returning a variant data type rather than a numeric.

TRANSFORM Val(Nz(Sum(Table1.Quantity),0)) AS SumOfQuantity
 
Yes, Duane's suggestion is a good idea.

JET can misunderstand the output from Nz(), so using Val() would force it to
understand the result as a (fractional) number.

If the crosstab should ouput the value as currency, use CCur(), or for whole
number, use CLng().
 

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

Similar Threads

Crosstab queries, <> and null values 3
crosstab 1
Null Values 4
string crosstab query 1
Help with crosstab query 10
Crosstab Query show null values 3
Help on crosstab query 2
Query Error Based on Crosstab Query 3

Back
Top