Negative number alignment

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.
 
D

Duane Hookom

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top