The issue is that I have to go to each individual cell and apply formatting through the wizard:
Code:
[WetlandStudyCompleteStatus]="Estimate" And DateValue(Date())+14>=DateValue([WetlandStudyComplete]) |
[WetlandStudyCompleteStatus]="Estimate" |
[WetlandStudyCompleteStatus]="Action Item" And DateValue(Date())+14>=DateValue([WetlandStudyComplete]) |
[WetlandStudyCompleteStatus]="Action Item" |
[WetlandStudyCompleteStatus]="Complete" |
[WetlandStudyCompleteStatus]="N/A" |
I want to come up with VBA code that does this formatting automatically when the report is opened, instead of applying conditional formatting to each individual control.
I don't know how to write the code, but the logic would look like this:
Code:
for each control on report x...
get control's data name (WetlandStudyComplete), save as a variable (c)
Add 'Status' to variable c (WetlandStudyCompleteStatus), save as variable (d)
use a dlookup maybe? point to the source table, find this project's WetlandStudyCompleteStatus value (complete), save as variable (s)
iif s = "Action Item" AND c <= 14 days from now, [code that applies certain formats control accordingly]
iif s = "Action Item", [code that applies certain formats control accordingly]
iif s = "Estimate" AND c <= 14 days from now, [code that applies certain formats control accordingly]
iif s = "Estimate", [code that applies certain formats control accordingly]
iif s = "Current", [code that applies certain formats control accordingly]
iif s = "N/A", [code that applies certain formats control accordingly]
next control
Any VBA experts that can help write this?
Thanks!