how display "-" for 0, centered?

I

Ian Elliott

Thanks for any help.
I have in my form, for a text box, the format:
#,###.0;(#,###.0);-
I would like the - (dash) to be centered in the text box when it is
displayed (ie when the value is zero). But I don't want positive numbers or
negative numbers to be centered. Is there something I can write in the format
so that only the dash is centered in the text box when displayed but not
anything else?
Thanks
 
D

Dennis

in the after update of the textbox put this code

If YourBox = 0 Then
YourBox.TextAlign = 2
Else
YourBox.TextAlign = 0
End If
 
A

Arvin Meyer

Untested:

Use the TextAlign property of the control in VBA code to set it
conditionally upon the value in the form's Current event and the control's
AfterUpdate event.

If Me.ControlName = 0 Then
Me.ControlName.TextAlign = 2
Else
Me.ControlName.TextAlign = 3
End If
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access Downloads
http://www.datastrat.com
http://www.mvps.org/access
 
Top