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

IF Statement 2

Status
Not open for further replies.

Michael091170

Technical User
Jan 7, 2005
14
GB
I know this is quite simple and I've done it before but I'm not getting much success.

I have several currency fields in a database I am reporting on.

the values are in £m. So at the moment I have the data field and an "m" in a text object. This doesn't look so good where ther is no value in the field as you get a floating "m".

I've tried writing an IF statement that only shows the "m" if there is a value in the field.

if {Capital_Value_pm} > 0 then ({Capital_Value_pm} & "m" )
else

and this is where I've got stuck.

Any help you can offer would be invaluable.

Thanks

Michael
 
Where are you trying to do this? In a code procedure? In a query grid?
 
well surely you want to display whatever it is when there is no value, so "zero", "missing" "0", whatever?

Or have I completely misunderstood? :)
 
This is a report from a SQL database and using formula editor.

If the filed is blank of the database I want it to be blank on the report so we can see where we need to add data.

I don't want a rogue "m" where there is not data as it looks untidy.

Thanks for your help
 
In that case if the fields is a string you just need a
 
after the else in your formula, I mean. Then you'll delete your text box with the "m" in it altogether.
 
I suspect that you've got an infinessimal; a value too small to show, but still distinguised from zero.
I'd do it as
Code:
If Round({Capital_Value_pm}, 2) = 0 then 0
else Totext({Capital_Value_pm}) & "m"

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top