View Full Version : Accessing global variables in report output


Will Adams
10-28-1999, 10:20 PM
In a report that shows confidential information about various individuals, I would like replace each individual's name with "********" except for a selected individual in the detail section of a report.

Currently the database contains a global variable that contains the correct string.

If I hard code the item in the Record Source property like:
iif([FullName] = "Doe, John", [FullName], "*********")
Then it works fine. However, with multiple reports, and where I may not know a new name, I would like to plug in the global variable. Whenever I plug in the global gsMasterName, I end up with a parameter query.

Any help would be useful.

I have tried to solve this in the query the form is based on, but get the same problem.

Thanks, Will

KDg
10-29-1999, 05:19 AM
have you tried using the input mask 'Password' in the box's properties?

Will Adams
10-29-1999, 10:00 AM
Using a Password imput mask would change the display for each detail line. The problem that I have is that I want to selectively either print the employee name (for one specific employee) or just astericks.

Thanks anyway...

Will

peldridg
11-03-1999, 12:23 AM
I think you will have to write a user function to return the name (as the data source). As I understand it globals are only accessible via code.

Control Source=Hide_Name([Full Name])

Public Function Hide_Name(sName as string) as string

....

exit function

Good luck
Phil

TonTon
11-03-1999, 03:27 AM
How about another option....

allow the user to select the employee (whose name should be displayed) from a combo box (called cmbEmployee) on a form (called frmSelectEmployee). Then in your query which feeds the report (or the report, itself) have a calculated field such as:

in query -
DisplayedValue: iif([EmployeeID] = Forms!frmSelectEmployee!cmbEmployee, [FullName], “****”)

OR in report -
=iif([EmployeeID] = Forms!frmSelectEmployee!cmbEmployee, [FullName], “****”)

[EmployeeID] above would be the ID of the employee, therefore the bound column in your combo box would need to be the ID aswell.

Hope this helps; cheers.