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!

Format part of a text box 2

Status
Not open for further replies.

NeilT123

Technical User
Jan 6, 2005
302
GB
This is the code that I have in a text box
Code:
=IIf([Cumg/l]>0," Copper analysis: " & [Field Name] & Chr(13) & Chr(10) & " Index " & [CuIndex] & Chr(13) & Chr(10) & " mg/l:  " & [Cumg/l] & Chr(13) & Chr(10) & " Status: " & [CuInterpretation])
I would like the [Cumg/l] to be formatted to 1 decimal place and if the value is 0.9 to show 0.9 rather than the .9 that it currently returns.
I have tried using format in front of the [cumg/l] but can't seem to get the correct answer.

I am not sure that what I am trying to achieve is possible, can anyone help with the code?
 
Is [Cumg/l] being returned as a single type value? That is what is sounds like....

Try replacing the [Cumg/l] with:

CStr(Format([Cumg/l], "#0.0"))

This should force a digit to be placed in at least the ones and tenths digit places and then give that value as a string...
 
Thank you for the prompt response. That works fine, thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top