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

Why is formula not working for one but not another?

Status
Not open for further replies.

kevnatajax

Technical User
Jun 25, 2002
14
US
I'm using CR7 on foxpro 2.5 dbf and trying to copy this formula and change month = 2. the formula below works for month = 1 but doesn't work for any other months. (data exist in other months) All formulas are in the Detail section. Report is grouped by year field. Please help.

This one works:
if tonumber({Clmanal.MONTH})=1 and ToNumber ({Clmanal.CODE}) in 1200 to 1299 then {Clmanal.TOTalPD}

Returns acturate totals

This on does not work:
if tonumber({Clmanal.MONTH})=2 and ToNumber ({Clmanal.CODE}) in 1200 to 1299 then {Clmanal.TOTalPD}

Returns 00's
 
If you deconstruct the query, so it's executed without the latter conditions, what happens?

i.e.

if tonumber({Clmanal.MONTH})=2 then {Clmanal.TOTalPD}

and

if ToNumber ({Clmanal.CODE}) in 1200 to 1299 then tonumber({Clmanal.MONTH})


Naith
 
Is it possible that there are NULL's in the database for one or all of the fields (my guess is for field {Clmanal.CODE} )...you do not have any way of protecting against this and your formula will crash if this is so. Jim Broadbent
 
Are you sure you are looking at records with Month = 2? They SHOULD be 0 in Month 1. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top