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

Formatting negative numbers 1

Status
Not open for further replies.

jwalz

Programmer
Oct 31, 2000
78
US
How can I format a number so that negative numbersare displayed within parenthesis, the way that they are in accounting statements?
For example, -2.53 would look like: (2.53)
 
If you are dealing with money, use the 'currency' format.
If not, you could do something like:

IIF(somenumber < 0, &quot;(&quot; &amp; -(somenumber) &amp; &quot;)&quot;, somenumber)

Mike Rohde
rohdem@marshallengines.com
 
for numbers there are 4 fields available for formatting. one for +, one for -, one for 0, &amp; one for NULL.

in your case put into the format statement for the field or control you could try putting

#,##0.00;(#,##0.00)

into the &quot;Format&quot; line of the properties page
 
oops! that's a semi-colon delimited list of format fields in the order i gave above that all go into the &quot;Format&quot; property of the Property page
 
The formatting suggestions were very helpful. Thank you. Now, however, when I use the negative number formatting (column 2), my field, on reports and forms, becomes centered or shoved over to the left such that the numbers are cut off, even though I have set the field to be right justified.

Any ideas as to why this is occuring?
 
mmm... interesting, i'll do a mock-up &amp; get back to you... it'll be a couple of days before i get back into town &amp; back to an access enabled computer

ttfn
 
So you set the control's &quot;Text Align&quot; on the report/form control to either &quot;Standard&quot; or &quot;Right?&quot; & it still shoved the values to the left?

you're using a TextBox control?
 
Yes, that is correct. Even though I set the Text Align to Right, when I use the format statement it sets it to the left. This happens both in the textbox control on the form as well as on the report.
 
I cannot replicate this behavior. It sounds like something is happening with the inheritance mechanism... but what?

Maybe you could e-mail a sample DB with that replicates the problem?

lafrance@exchange.tc.columbia.edu

Or we could go thru a longer Q&A session:
What is the underlying data type?
Where did you put the format statement?
Essentially, exacly what did you do & where did you do it?

But I have to warn you I've hit a wall with Q&A because I cannot replicate.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top