golfbum71
Board Regular
- Joined
- Aug 6, 2007
- Messages
- 123
Hello All,
I just came across this post:
http://www.mrexcel.com/forum/showthread.php?t=287465
And I've been able to add it in to my database -- Thank you very much SydneyGeek!
I noticed that there was a difference between Environ("username") and CurrentUser() -- namely that one is the actual computer user and the other is the logon they are using to get into the database.
So--in order to verify that users aren't farming out their user names, I'd like to add to the code.
I've created a CurrentUser column in the tblUserLog table...so I need to modify this:
to something like
If I missed something like it on the board, I apologize and look forward to any links.
Thank you all for any help...
Cheers,
Geoff
I just came across this post:
http://www.mrexcel.com/forum/showthread.php?t=287465
And I've been able to add it in to my database -- Thank you very much SydneyGeek!
I noticed that there was a difference between Environ("username") and CurrentUser() -- namely that one is the actual computer user and the other is the logon they are using to get into the database.
So--in order to verify that users aren't farming out their user names, I'd like to add to the code.
I've created a CurrentUser column in the tblUserLog table...so I need to modify this:
Code:
Dim sUser As String
Dim sSQL As String
DoCmd.SetWarnings False
sUser = Environ("username")
sSQL = "INSERT INTO tblUserLog ( UserID )" _
& "SELECT '" & sUser & "' AS [User];"
CurrentDb.Execute sSQL
'DoCmd.RunSQL sSQL
DoCmd.SetWarnings True
to something like
Code:
Dim sUser As String
Dim sSQL As String
Dim curUser As String
DoCmd.SetWarnings False
sUser = Environ("username") 'Name of person from system
curUser = CurrentUser() 'name used to logon
sSQL = "INSERT INTO tblUserLog ( UserID, curUser )" _ '<---This is where I have no clue
& "SELECT '" & sUser & "' AS [User];" '<-- I don't know how this
' works--there's no [user] I'm aware of in the table or in the form
' so I'm unsure how it works...
CurrentDb.Execute sSQL
'DoCmd.RunSQL sSQL
If I missed something like it on the board, I apologize and look forward to any links.
Thank you all for any help...
Cheers,
Geoff