Accessing global variables in report output

  • Thread starter Thread starter Will Adams
  • Start date Start date
W

Will Adams

Guest
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
 
have you tried using the input mask 'Password' in the box's properties?
 
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
 
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
 
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.
 

Users who are viewing this thread

Back
Top Bottom