P
pwdpwd via AccessMonster.com
Hi - could anyone help me with a simplification of some code that I have that
works ok, but is very onerous, and I'm sure that there must be a better way.
I have a report that contains 53 columns; as they are very small, they
contain either an 'X' or a 'T'. To make the T symbol stand out I run a
routine on the <On Print> event of the Detail section of the form that turns
the BackColor to Black and the ForColor to White. Code is as follows:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim lngblack As Long, lngwhite As Long
lngblack = RGB(0, 0, 0)
lngwhite = RGB(255, 255, 255)
If Me![Text115] = "T" Then
Me![Text115].BackColor = lngblack
Me![Text115].ForeColor = lngwhite
Else
Me![Text115].BackColor = lngwhite
Me![Text115].ForeColor = lngblack
End If
Trouble is, as there are 53 text boxes on the Detail section, is there any
way in VBA that I can shorten the code without having to replicate the last 7
lines of the above code for each of the 53 boxes?
works ok, but is very onerous, and I'm sure that there must be a better way.
I have a report that contains 53 columns; as they are very small, they
contain either an 'X' or a 'T'. To make the T symbol stand out I run a
routine on the <On Print> event of the Detail section of the form that turns
the BackColor to Black and the ForColor to White. Code is as follows:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim lngblack As Long, lngwhite As Long
lngblack = RGB(0, 0, 0)
lngwhite = RGB(255, 255, 255)
If Me![Text115] = "T" Then
Me![Text115].BackColor = lngblack
Me![Text115].ForeColor = lngwhite
Else
Me![Text115].BackColor = lngwhite
Me![Text115].ForeColor = lngblack
End If
Trouble is, as there are 53 text boxes on the Detail section, is there any
way in VBA that I can shorten the code without having to replicate the last 7
lines of the above code for each of the 53 boxes?