Calling a public function from within a report?

R

rick

I have a report with a field that prints the LastName and FirstName of a
client. "Trim([LastName] & " ," & [FirstName])"
For privacy purposes I would like to print the first 2 chars of the
LastName then override remaining characters with an "*". I have written a
public function, passing the lastname.
My question is how do I call this function from within the report? I tried
in Detail Formatting and Detail Printing events but that didn't do anything.

I'm using MSAccess 2008.

Thank you for your assistance.

Rick
 
B

Bill

rick said:
I have a report with a field that prints the LastName and FirstName of a
client. "Trim([LastName] & " ," & [FirstName])"
For privacy purposes I would like to print the first 2 chars of the
LastName then override remaining characters with an "*". I have written a
public function, passing the lastname.
My question is how do I call this function from within the report? I tried
in Detail Formatting and Detail Printing events but that didn't do
anything.

I'm using MSAccess 2008.

Thank you for your assistance.

Rick

Wouldn't: "Trim(Left([LastName],2) & "* ," & FirstName])" as
the source of the reports text box do "the trick"?

Bill
 
F

fredg

I have a report with a field that prints the LastName and FirstName of a
client. "Trim([LastName] & " ," & [FirstName])"
For privacy purposes I would like to print the first 2 chars of the
LastName then override remaining characters with an "*". I have written a
public function, passing the lastname.
My question is how do I call this function from within the report? I tried
in Detail Formatting and Detail Printing events but that didn't do anything.

I'm using MSAccess 2008.

Thank you for your assistance.

Rick

And your function is?
If you did want to use your function, (are you passing both names or
just the last name?) then as the control source of an unbound control:
=NameOfFunction([LastName],[FirstName])

This should do it without a user defined function needed.
As the control source of an unbound text control:
= Left([LastName],2) & String(Len([LastName])-2,"*") & ", " &
[FirstName]
 

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