print name or id of person running access report

Is there a way to print on a report the ID of the person who ran the report?
LindaOKSTATEAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Jeffrey CoachmanConnect With a Mentor MIS LiasonCommented:
Print where?


In a textbox do this as the controlsource

=CurrentUser()
0
 
clarkscottConnect With a Mentor Commented:
I think the only way to do this would be to code the app so someone clicks a button on a form to run the report.
There's code to determine each users SIGNON to the system and you could write code to add a record to a table each time someone clicks the button.

Are you interested in this solution?  If so, I can provide the code for determining a users signon name.

Scott C
0
 
clarkscottCommented:
Here you go...
Paste this function into your project:

Function CName() As String
'This function will get the login user ID of the person logged into the computer    Dim strUserName As String
    Dim x
    Set x = CreateObject("WSCRIPT.Network")
    CName = UCase(x.UserName)    
End Function

In the declaration section:  make CNAME a public variable:

public CNAME as string


Now, create a table with CNAME, DATE fields.   When the user clicks the button (on a form) to run the report, prior to (or after) the report is run  write the code to add a record to your table.  

rst!CNAME = CNAME()
rst!DateField = NOW()

Scott C
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
clarkscottCommented:
sorry for adding the comment "'This function will get the login user ID of the person logged into the computer    Dim strUserName As String"  in the code.  It really doesn't apply here.

Scott C
0
 
Jeffrey CoachmanMIS LiasonCommented:
Yeah, Scott I missed the "ID" part... (Not CurrentUser)

I am sure you can take it form here...

enjoy the weekend

;-)

Jeff
0
 
clarkscottCommented:
further... actually, you don't need to make the CNAME a public variable.  The function will return the name.

(PS.  I grabbed this code from an existing app and other things apply that I didn't consider and don't apply to your scenario.  Sorry for that confusion.)

Scott C
0
 
LindaOKSTATEAuthor Commented:
Jeff the =CurrentUser() returned "admin".  Scott, not sure if I want to go into that much programming,  I was hoping for an easy fix like the =CurrentUser().

I'll get back to this after I try a few more things.

Thanks,
LindaOKState
0
 
clarkscottCommented:
Are you logging into a business network?  If so, the CNAME should be the person's unique login "name".

If this doesn't work for you (as suggested by your last comment) then you may have to create a "login routine" (more programming).

There is no way for Access to determine who "runs" a report or query.  You're gonna' have to deal with it per code and tables.

Scott C
0
 
clarkscottCommented:
PS.  I've written many custom "login" procedures.  They all involve tables of users, user types (Admin, Read-Only, etc.) and passwords, a login form (includes code to change password), forces users to "log in", the user table must be available to "app admins", etc.   Yeah... lots of code.....    

I can help by pasting pieces of this type of procedure... but it is (somewhat) large.

Sorry..... :-)

Scott C
0
 
Helen FeddemaCommented:
CurrentUser will work -- but it may yield "Admin".  And of course there is no way of telling whether another person sat down at the computer and printed the report.
0
 
Helen FeddemaConnect With a Mentor Commented:
One way to do this might be to put a combo box on the main menu, for selecting user names.  You would have to select one in order to enable a button for printing a report.
0
 
Helen FeddemaCommented:
New Style Main MenuSee my New Style Main Menu (Access Archon #212).  You could use the same technique I use for selecting a Customer or Order ID for filtering a report, except without the filtering.

http://www.helenfeddema.com/Files/accarch212.zip
New Style Main Menu
0
 
Helen FeddemaCommented:
Sorry, didn't mean to post the image twice.
0
 
LindaOKSTATEAuthor Commented:
Thank you all, I have been told there are functions in my database that should pick up a global User ID but I probably will just not use this data on the report.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.