Problem with Decimal alignment in report (1 Viewer)

Richard M

Registered User.
Local time
Today, 01:58
Joined
Sep 29, 2010
Messages
75
I have a textbox in a report that shows both positive and (negative) numbers. The negative numbers are displayed as (10). My problem comes with alignment:

100.00
(50.00)

I tried to adjust the positions of the textboxes with the following vba code using twips in the Detail section.

When this report runs I get an error 2101
"The setting you entered isn't valid for this property"



Code:
 Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If ChangeOrderDollars < 0 Then
    Me.LabelIncreaseDecrease.Caption = "Decrease"
    Me.txtChangeOrderDollars.Left = 6945  'get error 2101
    Me.txtChangeOrderDollars.Width = 1754
Else
    Me.LabelIncreaseDecrease.Caption = "Increase"
    Me.txtChangeOrderDollars.Left = 6975
    Me.txtChangeOrderDollars.Width = 1935
End If
End Sub
Can anyone tell me what I'm doing wrong.

Richard
 

JHB

Have been here a while
Local time
Today, 08:58
Joined
Jun 17, 2012
Messages
7,732
You need to move it into the format event instead of the print event.
 

Richard M

Registered User.
Local time
Today, 01:58
Joined
Sep 29, 2010
Messages
75
Thanks JHB for the help, but during the time of posting and now I solved the problem.

Here is what I did.



In the text box properties:

I changed the Other/Name to txtCurrentDollars.

In Format/Format I selected standard and then 2 decimals.

In the Data/Control Source I put the following:
=Format([CurrentDollars],"#,#00.00;(#,#00.00)")

Richard
 

Users who are viewing this thread

Top Bottom