C
cynteeuh
I copied the below and pasted per your instructions, but nothing changed. I'm
thinking it may be my unbound text box. There isn't any control source. This
is the box I'd like shaded per the colors based on the name. It is next to
the field/textbox that has the name. Any suggestions? :-/
Also, was I supposed to leave the name " 'lt blue" in the code?
Is the last color purple? If not, what is the code for purple?
Thanks AGAIN for your help!!! I truly appreciate it!
thinking it may be my unbound text box. There isn't any control source. This
is the box I'd like shaded per the colors based on the name. It is next to
the field/textbox that has the name. Any suggestions? :-/
Also, was I supposed to leave the name " 'lt blue" in the code?
Is the last color purple? If not, what is the code for purple?
Thanks AGAIN for your help!!! I truly appreciate it!
Marshall Barton said:First, open the report )the one you are using as a
subreport) in Design View. Then click on a *blank* area of
the report section (Detail?) that contains the name text
box. In the properties list, under the Events tab, select
[Event Procedure] from the drop list on the right side of
the OnFormat property. That should open the report's VBA
module and put the cursor in the event procedure, ready for
you to enter the code:
Select Case Me.coname
Case "John"
Me.coname.BackColor = vbRed
Case "Cyn"
Me.coname.BackColor = Rgb(220,220,255) 'lt blue
Case "Rod"
Me.coname.BackColor = vbBlue
Case "Antonio"
Me.coname.BackColor = vbGreen
Case Else
Me.coname.BackColor = vbWhite
End Select
--
Marsh
MVP [MS Access]
Sorry to be a pain, but it is a bit over my head. Where would I enter this
info? Is it in the properties, which has five tabs (format, data, event,
other, & all)? If so, where or how would you enter this?
I'm trying to create a grid with the color chart next to the name.
Color CoName
Red John
Lt Blue Cyn
Dk Blue Rod
Green Antonio
Therefore, if the field coname is "john", the box is shaded red. If it's
"cyn", the box is shaded lt. blue, etc. This is a report based on a crosstab
query that I'd like to embed as a sub rpt in the rpt header. I'm using it as
a legend. It's working, except for the conditional formatting limitation. The
current rpt is block style (spreadsheet format). The first column is an
unbound text box (shaded by conditional formatting based on [coname]). The
next column is the coname. The remainder columns are the totals.
Thanks AGAIN for helping on this! Apologies for my ignorance!
Marshall Barton said:The general idea for doing this in the report Detail
section's Format event procedure is something like:
Select Case Me.coname
Case "x"
Me.coname.BackColor = vbRed
Case "y"
Me.coname.BackColor = Rgb(220,220,255) 'lt blue
Case "z"
Me.coname.BackColor = vbBlue
. . .
Case Else
Me.coname.BackColor = vbWhite
End Select
If that's too confusing for you, then explain more about the
"x" and anything else you don't follow.
--
Marsh
MVP [MS Access]
cynteeuh wrote:
Basically, if [coname]=x, then use color per the below. I've setup the
conditional formatting for three, but I can't do the additional due to
limitation.
Red
Lt Blue
Dk Blue
Purple
Green
:
cynteeuh wrote:
I don't know VBA. Is there any other alternative for more than 3 conditions
in conditonal formatting? I need six or five since I can use the default as
the sixth.
Well there is, but it's more complicated than the simple
code that you can use in a report (or single view form, but
not in a continuous or datasheet form).
If you will explain the conditions you want to use
(including the names of the text box controls), I'll take a
shot at the code to do it.