LindaOKSTATE
asked on
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
Scott C
Yeah, Scott I missed the "ID" part... (Not CurrentUser)
I am sure you can take it form here...
enjoy the weekend
;-)
Jeff
I am sure you can take it form here...
enjoy the weekend
;-)
Jeff
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
(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
ASKER
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
I'll get back to this after I try a few more things.
Thanks,
LindaOKState
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
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
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
I can help by pasting pieces of this type of procedure... but it is (somewhat) large.
Sorry..... :-)
Scott C
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.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
See 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
http://www.helenfeddema.com/Files/accarch212.zip
Sorry, didn't mean to post the image twice.
ASKER
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.
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.Netw
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