reports in access 97

  • Thread starter Thread starter MStrider
  • Start date Start date
M

MStrider

how the hell do I change the back colour of a textbox on the fly using vba?

I am trying this, but the property of backcolour doesn't seem to work in
reports

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull(Me.mailer_number) Then
Me.TXT_mmail = ""
Me.TXT_mmail.backcolor = RGB(0, 0, 0) - this bit doesn't work
Else
Me.TXT_mmail = "MMAIL"
Me.TXT_mmail.backcolor = RGB(255, 255, 255) - this bit doesn't work
End If
End Sub

Thanks for your help!
 
-----Original Message-----
how the hell do I change the back colour of a textbox on the fly using vba?

I am trying this, but the property of backcolour doesn't seem to work in
reports

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull(Me.mailer_number) Then
Me.TXT_mmail = ""
Me.TXT_mmail.backcolor = RGB(0, 0, 0) - this bit doesn't work
Else
Me.TXT_mmail = "MMAIL"
Me.TXT_mmail.backcolor = RGB(255, 255, 255) - this bit doesn't work
End If
End Sub

Thanks for your help!


.
Look up Conditional Formatting in help. That is best way
to do what you want.
 
Here's an example that works on one of my reports.

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If Me!ErrorCheck = True Then
Me!ErrorCheckProjectNumber.ForeColor = 255 'red
Else
Me!ErrorCheckProjectNumber.ForeColor = 0 'black
End If
End Sub
 
This should do it for you..

'report detail
Dim greenbar As Boolean

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If greenbar Then
Detail.BackColor = 12181965
Else
Detail.BackColor = vbWhite
End If
greenbar = Not (greenbar)
End Sub


Maurice
 
Back
Top