Alternate rows with bold font

G

*Glen*

Alright...Duane showed me how to find the immediate window. The report name
is rptMatrix2_1. The control's name is personnel_2008. It still does not
work. Here is what I entered exactly as the code with all punctuation, etc:

reports("rptMatrix2_1").Controls("personnel_2008").formatconditions(0).backcolor
= rgb(197,236,255)
 
D

Dale Fye

What do you mean "it still does not work"?

My guess is that the expression you are using for the backcolor is never
evaluating to true. Or, you might need to use a different
FormatCondition(#).

Did you get an error when you typed that line and hit enter?

Was the report in design view at the time? It needs to be.

Do you already have a condional format set for that control? If not, you
must first define a conditional format for the control. I chose to set it to
an expression that would always evaluate to True but if you are using this
for alternate row stuff, then you can use whatever expression you were using
for that. Once you have created that condition, then you should be able to
use that line of code to set the backcolor to the appropriate value.

Is the textboxes control name actually "personnel_2008" or is that the
control source for the textbox (or both).

Did you save the report after running that line
 
G

*Glen*

(1) It still does not work, meaning, the controls appear without color when I
open them in print preview.

(2) There were no errors when I typed the line of code in the immediate
window or when I chose print preview.

(3) Report was in design view. I hit CTRL + G and added the code to the
immediate window. Clicked save.

(4) I have a conditional format set for the control. Default formatting is
normal font with back color #C5ECFF. Condition 1 expression is txtBold
(which is the name of an invisible text box I added to the report) Mod 2.

(5) The text box's actual name is personnel_2008. This is the control whose
color I want to be #C5ECFF when I run the report. The conditional formatting
makes the font bold, but makes the back color clear or white.

***This is Access 2007***
 
D

Dale Fye

OK, lets try this.

Open the report in design view
Open the code window, and in the Immediate window type
?rgb(197,236,255)

Then hit enter. Now type:

?reports("reportname").Controls("control_name").formatconditions(0).backcolor

Then hit enter. What do you see on the line below the one you just typed?

Now type:

?reports("reportname").Controls("control_name").formatconditions(1).backcolor

Then hit enter. Copy everything in the Immediate window and paste it in a
response to this email.

Dale
 
C

Clifford Bass via AccessMonster.com

Hi Glen,

That is easily solved. Set the Back Color property of the text box to in
the normal fashion using the fill icon in the Home ribbon. Click on the down
arrow of the icon, not the main portion of the icon. You will need to choose
"More Colors" and then "Custom". Enter 197, 236, 255 for the Red, Green and
Blue. If they are already set to that change one and change it back. Click
OK. Now go into Conditional Formatting. You will see that the fill color
button now shows the custom color. In the first condition click on the icon
itself, not on the down arrow. Click OK. That should do it.

Clifford Bass
 
G

*Glen*

Dale,

Thanks for your patience. I really appreciate your help. As requested,
here is what is displayed in the immediate window:

16772293
?reports("rptMatrix2_1").Controls("personnel_2008").formatconditions(0).backcolor
16777215
?reports("rptMatrix2_1").Controls("personnel_2008").formatconditions(1).backcolor

***When I hit enter after typing the last line above, a message box appears
saying "The format condition number you specified is greater than the number
of format conditions."

I hope you have a great new year and I am sure that if we get this resolved,
2010 will start off awesome for me. Thanks for all of your time!

Glen
 
C

Clifford Bass via AccessMonster.com

Hi Dale and Glen,

Yes,there is only one format condition so the second item would error
out. Please see my easier solution in reply to your last message Glen that
was in reply to my prior message. No messing around with the immediate
window or trying to do something in code.

Clifford Bass
 

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