Urgent! Colour or bolding control problem

Blackwidow

Registered User.
Local time
Today, 03:11
Joined
Apr 30, 2003
Messages
149
I have a rather complex report, the report is based on number calculation... I want the report to either shade the field or colour it.. if the number in the field is negative... is this possible? If not I am going to have to scrap 6mths work!!

Please help!!
 
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

   If Me.YourField < "0" Then
          Me.YourField.FontBold = True
          Me.YourField.ForeColor = vbRed
    Else
          Me.YourField.FontBold = False
          Me.YourField.ForeColor = vbBlack
    End If

End Sub

Change "YourField" to the Name of the text box.

HTH
IMO
 
Sorry, my mistake, get rid of the " " from around the 0.

IMO
 
Put all my fields in but... it doesnt appear to have done anything?
 
To add another field do something like...
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

   If Me.YourField < 0 and Me.YourSecondField < 0 Then
          Me.YourField.FontBold = True
          Me.YourField.ForeColor = vbRed
          Me.YourSecondField.FontBold = True
          Me.YourSecondField.ForeColor = vbRed
    Else
          Me.YourField.FontBold = False
          Me.YourField.ForeColor = vbBlack
          Me.YourSecondField.FontBold = False
          Me.YourSecondField.ForeColor = vbBlack
    End If

End Sub

IMO
 
Last edited:
Wonderful!

That works fantastically!!!! Some times you lot are so clever it must suprise yourselves!
 
Or you could just set the Format of the control to
#,##0.00[Black];#,##0.00[Red]
 

Users who are viewing this thread

Back
Top Bottom