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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffrey CoachmanMIS LiasonCommented:
Print where?


In a textbox do this as the controlsource

=CurrentUser()
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
clarkscottCommented:
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
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

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 FeddemaCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

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.