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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

crosstab invalid use of null

Status
Not open for further replies.

scottian

Programmer
Joined
Jul 3, 2003
Messages
955
Location
GB
ive got a crosstab query to count the number of completed jobs grouped on age. I was getting an error invalid use of null. So did a bit digging around found the Nz function but im still getting the error. Does anyone have any ideas?


TRANSFORM Count(Nz([FBR])=0) AS [The Value]
SELECT qryNR.Fuel, Count(qryNR.FBR) AS Total
FROM qryNR
GROUP BY qryNR.Fuel
PIVOT qryNR.Age_Band;


"Children are smarter than any of us. Know how I know that? I don't know one child with a full time job and children."...Bill Hicks
 

Nz([FBR])=0

Should be

Nz([FBR], 0)

Or

Nz([FBR])
 
Null values in the Count() would not cause the error message. Is it possible that Age_Band might be null? If so, try:
Code:
TRANSFORM Count([FBR]) AS [The Value]
SELECT qryNR.Fuel, Count(qryNR.FBR) AS Total
FROM qryNR
GROUP BY qryNR.Fuel
PIVOT Nz(qryNR.Age_Band,"No Age Band");

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top