Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing global vars in report output 2

Status
Not open for further replies.

WilliFixit

Programmer
Oct 28, 1999
2
US
In a report that shows confidential information about various individuals, I would like replace each individual's name with &quot;********&quot; except for a selected individual in the detail section of a report. <br>
<br>
Currently the database contains a global variable that contains the correct string.<br>
<br>
If I hard code the item in the Record Source property like: <br>
iif([FullName] = &quot;Doe, John&quot;, [FullName], &quot;*********&quot;) <br>
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.<br>
<br>
Any help would be useful.<br>
<br>
I have tried to solve this in the query the form is based on, but get the same problem.<br>
<br>
Thanks, Will
 
Write a function which returns the global variable, eg if your global variable is called gsMasterName, then<br>
<br>
function FN_sMasterName as string<br>
FN_sMasterName = gsMasterName<br>
end function<br>
<br>
Then you should be able to set the source for your text box as <br>
iif([FullName] = FN_sMasterName, [Full Name], &quot;*********&quot;) <br>
<br>
You should be able to add this function into the code for the report; if this doesn't work, just bung it in a module somewhere else.<br>
<br>
Hope this helps<br>
<br>
Jonathan
 
Jonathan,<br>
<br>
Excellent suggestion and elegant solution!<br>
<br>
Thanks a lot!<br>
<br>
Will
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top