Negative number alignment

  • Thread starter Thread starter ExcelMan
  • Start date Start date
E

ExcelMan

I have a report where the numbers in a column will not align. I have
read most of the posts on this forum on this subject and have made
sure controls are the same width, aligned, same format and alignment.

Everything works fine when all the numbers are positive. Negative
numbers in the detail section align a little too far to the left.

Is it possible in a report event, such as the Format event, to test
for the value in the control and then adjust either the Left or
LeftMargin property to push a negative number to the right? I have
tried code like this:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If [txtDueAmt] < 0 Then
Me.txtDueAmt.Properties("Left") = (6.3 * 1440) + 12
Else
Me.txtDueAmt.Properties("Left") = (6.3 * 1440)
End If
End Sub

But this seems to move ALL the txtDueAmt values, regardless of the row
or the actual value, to the same Left position. I need those with
negative values to move to the right and those without negative values
to stay where they are.

How can I do this?

Thanks.
 
Have you checked to see if your If statement evaluates correctly? Maybe set a
forecolor property to see what happens. 12 twips isn't very large. Maybe try
120 just to check your code.
 
Back
Top