[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 354
  • Last Modified:

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?
0
LindaOKSTATE
Asked:
LindaOKSTATE
  • 6
  • 4
  • 2
  • +1
3 Solutions
 
Jeffrey CoachmanMIS LiasonCommented:
Print where?


In a textbox do this as the controlsource

=CurrentUser()
0
 
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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
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

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 6
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now