Printing Username at bottom of report

M

mattieflo

Hello everyone,

I'm just trying to figure out a way to put a "Printed By:" followed by the
username of the person who printed the report. Anyone know what's the best
way to do this? Thanks!
 
D

Dirk Goldgar

(re-posting, as my original reply hasn't appeared -- sorry if this is a
duplicate)

mattieflo said:
Hello everyone,

I'm just trying to figure out a way to put a "Printed By:" followed by the
username of the person who printed the report. Anyone know what's the best
way to do this? Thanks!

Where are you getting the username? If you're using workgroup security,
then maybe it's CurrentUser() you want, and you could have a text box in the
page footer with this ControlSource expression:

="Printed by: " & CurrentUser()

If you're not using workgroup security, then you must have some function
that returns the user name. For example, you might use the fOSUserName
posted here: http://www.mvps.org/access/api/api0008.htm . With that
function saved in a standard module, your controlsource expression could be:

="Printed by: " & fOSUserName()

You can also usually get that name from the operating systems environment
strings, which you can get at like this:

="Printed by: " & Environ("USERNAME")

However, that's less reliable than using fOSUserName.
 
Top