Can this be done?

M

mscertified

I have two columns in the table that feeds my report. One column determines
the color of a report control and the other column determines the content.
Both columns contain data, the first contains a color code e.g. 1=Yellow,
2=Red, 3 = Blue etc.
Obviously the report controls must overlay each other and the content of the
color column must not display. The content of the content column must display.
Is it possbile to set up the properties such that the background color of
the underlying control shows together with the forecolor of the overlaying
control?
No, I don't want to use conditional formatting!
Hope I have explained this clearly.
 
M

Marshall Barton

mscertified said:
I have two columns in the table that feeds my report. One column determines
the color of a report control and the other column determines the content.
Both columns contain data, the first contains a color code e.g. 1=Yellow,
2=Red, 3 = Blue etc.
Obviously the report controls must overlay each other and the content of the
color column must not display. The content of the content column must display.
Is it possbile to set up the properties such that the background color of
the underlying control shows together with the forecolor of the overlaying
control?


First, make the color code text box invisible so it doesn't
get in the way.

Then, use the detail section's Format event to set the data
text box's BackColor property according to the code in the
color text box:

Select Case txtColorCode
Case 1
Me.txtContent.BackColor = vbYellow
Case 2
Me.txtContent.BackColor = vbRed
Case 3
...
...
Case Else
Me.txtContent.BackColor = RGB(192,192,192) 'Gray
End Select
 
D

Duane Hookom

You can use code in the On Format event of the section like:
'txtColor must be bound to the color field
'the background must not be set to transparent
Select Case Me.txtColor
Case 1
Me.txtContent.BackColor = vbYellow
Case 2
Me.txtContent.BackColor = vbRed
Case 3
Me.txtContent.BackColor = vbBlue
Case Else
Me.txtContent.BackColor = vbWhite
End Select
 
M

mscertified

I did it by making the background style of the overlaying control
'transparent', the underlying control has its backcolor and forecolor set to
the same value thus making the color setting character invisible. Works fine.
 

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