If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Pull report values in VBA
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, -- Chris Unger Analyst - Tyler, TX |
#2
|
|||
|
|||
Pull report values in VBA
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. -- Duane Hookom Microsoft Access MVP "cunger28" wrote: 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, -- Chris Unger Analyst - Tyler, TX |
Thread Tools | |
Display Modes | |
|
|