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

How can I make Access display a + sign in front of positive integers, just as it does - for neg? 2

Status
Not open for further replies.

TheresAlwaysAWay

Programmer
Mar 15, 2016
135
US
Really, the subject is the whole question. I have text fields on a report (General Number format), and if possible I'd like to display a + before positive numbers.

Any suggestion is appreciated.
 
As combo suggests, use the format property of the text box. This is a sample you can use to start:
Format: +#,###;(#,###.##)[Red];"zero";"Empty"

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
Thank you both.

Quick question. Is +265 from the custom formatting treated as a number or text?
 
Thank you both so much. This worked...but there's one small problem. The + numbers are text aligned left, while negative numbers are text aligned right. It doesn't matter what I set the alignment as. Is there some way to get the numbers to align normally to the right?

BTW Duane, I modified the sample you provided slightly, to be +#,###;-#,###.##[Red];"zero";"Empty" since I preferred simply to have a -11 displayed instead of (11), but it worked super. Now if I can just get the text alignment to cooperate I'm golden!

BTW, I tested the VarType, and it resolved as 3, or long integer.
 
One more thing. I further modified the formatting to read +#,###;-#,###.##[Red];0;"Empty" since I didn't want the word zero, but instead the character 0 displayed.

I also tested the text alignment and found something curious. If I set the alignment to Left then all the text including the negative values align left, but If I set it to align right, only the negative values move. Any suggestions?
 
I don't get left alignment. If I change the alignment to left or right, the values appear as expected.
My format is set to: +#,###;-#,###.##[Red];0;"Empty"

PlusMinusFormatting_ncydxe.png


Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
TheresAlwaysAWay said:
...I didn't want the word zero, but instead the character 0 displayed
Try +#,###;-#,###.##[Red];"";"Empty"

combo
 
I wrote essentially this same post and it disappeared. Either I'm losing it or Tek-Tips is! If it suddenly reappears and posts and you see it twice please don't think I'm any crazier than I actually am!

I have no idea what happened with the formatting issue. For some unknown reason it resolved itself. I have a photo of it before so you can see what I was seeing.
TextAlignTest_ibqdkm.jpg
And the two other columns displayed don't sum to the third column because they're not the two that are being compared.

Sorry the photo is so big. It was a snap from my cellphone, not a screenshot, and I was too lazy to reduce it.

Regardless, it's completely irrelevant at this point. Everything is working great.

Combo, I decided to go back to my original format of +#,###;-#,###[Red];0;"Empty" because the empty set left the field blank when the result was 0. I also removed the decimal point in the negative numbers since these are integers only.

You guys are stars and you deserve stars on your posts for all the help. I've already done it.

I really do appreciate the efforts you put forth for strangers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top