Pull report values in VBA

C

cunger28

I have a list of fields that I'm pulling in to my report. Basically values
for Jan - Dec. For each month I would like to conditionally format the back
color depending on the value each month. Conditonal formatting in Access 07
only seems to allow 3 conditionals. I need more. I figured why not code it on
the form open command. Is this doable?

I thought I could do something along the lines of:
If Me!Jan.Value >= 90 Then
Me!Jan.BackColor = "#224422"
Else
If Me!Jan.Value < 90 Then
Me!Jan.BackColor = "#220011"
End If
End If

Whenever I try to preview I get a run time error of 2424. It doesn't like
the .Value portion of my code. If it matters at all, the report data is
being fed from a query and not a static table.

Thanks,
 
D

Duane Hookom

You should place code in the On Format event of the section containing the
controls. The color values should be long integers or constants like vbYellow.
 

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