Conditional Formatting not working in report detail

B

Barry A&P

i have an access2007 report that i am trying to setup conditional formatting
where the user sets the "Alert Value" by a single record in a table here is
my expression

[LastAttendance]<Date()-DLookUp("[alertvalue]","alertvalue")

this works great on the controls in my section header but i want to use it
in my section detail where [lastattendance] actually resides.. if i click a
control in my detail while viewing the report the control turns red unless
the specific control doesnt meet the expressions criteria.. but it only
changes temporarily while the control has the focus?

i replaced the expression with 1 = 1 and "1" = "1" but the detail
controls would turn red while the header controls will do i have a property
somewhere that is preventing this??

i hope i have enough detail
Thanks
 
A

Allen Browne

Your DLookup() expression has no criteria, so I assume there is just one
record in the alertvalue table, and you want to apply it to all records in
your form. I assume that the alertvalue field is a Number type (since you
are subtracting it from a date.)

To make this efficient, the DLookup() only needs to be done once when the
form opens, not for every record. Therefore put a text box in your Form
Header section, and give it these properties:
Control Source =DLookUp("[alertvalue]","alertvalue")
Format General Number
Visible No
Name txtAlertValue

Now try setting the Conditional Formatting for your text box to:
Expression [LastAttendance] < Date() - [txtAlertValue]
 
B

Barry A&P

allen

your assumptions are correct with my dlookup criteria the table only has one
record. is my set alert value form with a text box bound to a table with
one record and one field the wrong approach? you usually have extremely
simple fixes for the stupid stuff us learners tend to do. is there a better
way to store a single value that can be used to set my conditional formatting
on all reports (in a runtime database)


Thanks so much for the suggestion of adding a hidden txtalertvalue control
it really helped with my forms performance but it did not fix my conditional
formatting..

i am reasonably sure the expression is working but for some reason a
property somewhere is preventing or overriding the the conditional formatting
is this possible??

Thanks for doing what you do

Barry

Allen Browne said:
Your DLookup() expression has no criteria, so I assume there is just one
record in the alertvalue table, and you want to apply it to all records in
your form. I assume that the alertvalue field is a Number type (since you
are subtracting it from a date.)

To make this efficient, the DLookup() only needs to be done once when the
form opens, not for every record. Therefore put a text box in your Form
Header section, and give it these properties:
Control Source =DLookUp("[alertvalue]","alertvalue")
Format General Number
Visible No
Name txtAlertValue

Now try setting the Conditional Formatting for your text box to:
Expression [LastAttendance] < Date() - [txtAlertValue]

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Barry A&P said:
i have an access2007 report that i am trying to setup conditional
formatting
where the user sets the "Alert Value" by a single record in a table here
is
my expression

[LastAttendance]<Date()-DLookUp("[alertvalue]","alertvalue")

this works great on the controls in my section header but i want to use it
in my section detail where [lastattendance] actually resides.. if i click
a
control in my detail while viewing the report the control turns red unless
the specific control doesnt meet the expressions criteria.. but it only
changes temporarily while the control has the focus?

i replaced the expression with 1 = 1 and "1" = "1" but the detail
controls would turn red while the header controls will do i have a
property
somewhere that is preventing this??

i hope i have enough detail
Thanks
 
B

Barry A&P

Allen

Got it the control backstyle was set to transparent, Normal fixed the
problem..
Thank you again for your help..

Barry

Allen Browne said:
Your DLookup() expression has no criteria, so I assume there is just one
record in the alertvalue table, and you want to apply it to all records in
your form. I assume that the alertvalue field is a Number type (since you
are subtracting it from a date.)

To make this efficient, the DLookup() only needs to be done once when the
form opens, not for every record. Therefore put a text box in your Form
Header section, and give it these properties:
Control Source =DLookUp("[alertvalue]","alertvalue")
Format General Number
Visible No
Name txtAlertValue

Now try setting the Conditional Formatting for your text box to:
Expression [LastAttendance] < Date() - [txtAlertValue]

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Barry A&P said:
i have an access2007 report that i am trying to setup conditional
formatting
where the user sets the "Alert Value" by a single record in a table here
is
my expression

[LastAttendance]<Date()-DLookUp("[alertvalue]","alertvalue")

this works great on the controls in my section header but i want to use it
in my section detail where [lastattendance] actually resides.. if i click
a
control in my detail while viewing the report the control turns red unless
the specific control doesnt meet the expressions criteria.. but it only
changes temporarily while the control has the focus?

i replaced the expression with 1 = 1 and "1" = "1" but the detail
controls would turn red while the header controls will do i have a
property
somewhere that is preventing this??

i hope i have enough detail
Thanks
 

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