Conditional Formatting in Report

GUIDO22

Registered User.
Local time
Today, 15:45
Joined
Nov 2, 2003
Messages
515
I need to call a function in the Conditional Formatting property of a text field used on my report.

For example: CheckNames(Reports!Reporting_EmployeeOutput![txtSurname], "Smith")

Where txtSurname is the text field control on the report. However, this does not work -
(Am I even able to put a reference to the control itself in this property - ?)

I have used 'Expression Is' as the condition type.

(Basically, I am trying to format the control text forecolor in accordance with the text box content. If my search name is Smith - this condition needs to check the name in the field with Smith - if they dont match - I set the backcolor to match the forecolor - thereby making the non-matched name invisible)

Is this possible.


NB. I have had no responses from my prev. LINK - I am hoping this maybe the solution I am looking for.
 
Built in functions work I've used

DateDiff("yyyy",[mydate],Date())>1)

Note that mydate is the control source not the control name on the report.

Brian
 
Does Checknames return a TRUE/False result as that is what is required.

Brian
 
Built in functions work I've used

DateDiff("yyyy",[mydate],Date())>1)

Note that mydate is the control source not the control name on the report.

Brian

Brian - I specifically need to reference the control name - the name instance I am checking against will be retrieved from say combo box on the form from where the report is executed. So, if the combo selection is Smith - when the report runs - names other than Smith are fomatted white on white (ie. rendered invisible).
 
Knowing how inconsistent software can be just checked and conditinal formatting will accept the control name or the Source. which presumable means that you can code
CheckNames([txtSurname], "Smith")
Provided that the response is either TRUE or FALSE

Brian
 
I just checked you previous thread, but I'll post this here since it's the most recent.

You can get the same result if you use a union select query as the control source for the report...just requires a little knowledge of SQL.

something like:

Code:
Select TABLE.NAME, TABLE.OTHER_FIELD
FROM TABLE
WHERE (TABLE.NAME = [ENTER EMPLOYEE NAME])
UNION
SELECT "******" AS NAME, TABLE.OTHER_FIELD 
FROM TABLE
WHERE (NOT (TABLE.NAME = [ENTER EMPLOYEE NAME]))

In the example I posted, when you open the report you'd be prompted to "ENTER EMPLOYEE NAME". In every record where the name matches, the name will be displayed. In every record where the name doesn't match, ****** will be displayed - all other fields will show as normal.

Of course, if you have more than one employee with the same name, you'd want to use a unique field as the criteria (such as Social Security Number) or use a combination of fields (such as Last Name, First Name, Middle Name, etc) to make sure the name only shows up for the correct employee.
 

Users who are viewing this thread

Back
Top Bottom