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

Calculated Field

Status
Not open for further replies.

linda55

Technical User
Jun 22, 2001
19
0
0
US
I am a self-taught Access97 worker with gaps in my learning, so please have mercy! I have a query based on a crosstab query. In the query I have a calculated field
Tot:[Jul]+ [Aug]
Works fine unless Jul or Aug is blank, then returns nothing; that is, won't return the Aug amount. Jul and Aug are formatted as currency. Could someone point me in the direction of a solution?
 
The SQL for my crosstab query is as follows
TRANSFORM Sum([Daily Entries].Credit) AS [The Value]
SELECT [Daily Entries].RevNo, Sum([Daily Entries].Credit) AS [Total Of Credit]
FROM [Daily Entries]
WHERE ((([Daily Entries].AcctNo)=".08"))
GROUP BY [Daily Entries].RevNo, [Daily Entries].AcctNo
PIVOT Format([Date],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");

How and where do I insert the NZ to get the query to return zeros where there is no data to add. My knowledge of SQL is very limited.
 
linda,

It's pretty simple,

Just use this function:

Tot:NZ([Jul],0)+ NZ([Aug],0)

That way if Jul is null you'll just get Aug, and vice versa, if both are null you'll get 0

Kyle [pc2]
 
Thanks, KyleS, you were kind to reply to my call for help.
 
Linda,
No problem, that's what we're here for! Kyle [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top