Connecting Tech Pros Worldwide Forums | Help | Site Map

Aligning number values

John
Guest
 
Posts: n/a
#1: Jan 29 '06
Hi

I need to right justify amounts in a field with width of x digits. I have
tried Format(2.35, "##########0.00") but the numbers come out left
justified. Anyway to justify them on the right like the currency amounts
should be?

Thanks

Regards



Allen Browne
Guest
 
Posts: n/a
#2: Jan 29 '06

re: Aligning number values


The Format() function generates a string, and Access therefore treats it as
text.

Could you set the Format property of the text box instead of using the
Format() function? Not only would it align as a number, but you could
perform math on it (e.g. sum or average.)

If you want to treat it as text anyway, you could right-align the text box.
(Toolbar icon in design view.)

If you are trying to calculate the actual width on a report, see:
http://www.lebans.com/textwidth-height.htm

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"John" <John@nospam.infovis.co.uk> wrote in message
news:eKxB53OJGHA.2828@TK2MSFTNGP12.phx.gbl...[color=blue]
>
> I need to right justify amounts in a field with width of x digits. I have
> tried Format(2.35, "##########0.00") but the numbers come out left
> justified. Anyway to justify them on the right like the currency amounts
> should be?[/color]


lesperancer@natpro.com
Guest
 
Posts: n/a
#3: Jan 30 '06

re: Aligning number values


try format(Format(2.35, "##########0.00"),string(12,"@"))
to right justify in a 12-character field

Closed Thread