Click to See Complete Forum and Search --> : Capture User name in Access 2000
Lowland
April 3rd, 2001, 04:33 AM
Anyone tell me how to capture the User name of the local machine user for recording as a default value in a table?
Also, capturing the IP address of the local machine would be useful too.
Database on server, access permissions through NT Security. This is a .mdb, not a back-end database.
Thanks in advance
Lowland
April 11th, 2001, 11:09 AM
No-one got any ideas???
Look, I know the info is in the *.ldb that access creates, and I know this is readable, cos I have a programme that does this, but I can't get at the code.
One more try anyone got any ideas???
Thanks
jeffsr
April 11th, 2001, 08:47 PM
Capturing the current user logged on to the workstation is an sql procedure, and usually requires an sql data source set up thru ODBC. The user will have to log onto the sql database and the username can be captured by the <get current user sql statement.
Here is a snippett from the sql help file.
When an application connects to SQL*Server, using SQLDriverConnect, the application may generate a prompt for data source information. This prompt can be in the form of a Data Source query or a dialog box. For a Data Source query, enter the name of the data source. For a dialog box, complete the dialog box as follows:
1. Enter or select the server name.
2. In the Login ID entry field, type your SQL*Server login ID.
3. In the Password entry field, type your SQL*Server password.
4. Choose OK.
and so on. The bottom line here is using ODBC you can capture the current NT login and use it for sql verification, but the database has to be set up to perform that sql passthru. In other words, the solution to your query is not a simple one..
Lowland
April 12th, 2001, 04:38 AM
Thanks jeffsr for the reply. I guess it isn't a simple procedure, but maybe my explanation is bad!
I want to capture the current user name of the database. So, Joe logs on at machine 1, connects to shared database mydatabase.mdb on Server1 (simple sharing, no SQL server, no need for ODBC source because the only programme is Access, in essence the user is accessing the programme and data on the server). Access then creates an mydatabase.ldb file which records this info (plus all the other stuff like record-locking et al. I have a programme which can read the user name, and one or two other things, but I can't use this data. I want to pick up the current User and insert the name, with a timestamp (that's a doddle!) so I can track the changes made to data by whom and by when. Yeah, I can force a field (required) "You must enter your name", but of course this is easily run around. I just can't find the code/way to access the data in the .ldb file.
This must be do-able, I'm using commercial databases that are coded to do this.
If you've any more ideas I'd be really grateful. Although my database is working, this added security would help.
Thanks again
scutterboy
April 17th, 2001, 10:43 AM
Dont have the first idea how to do it but at my office we use an access application that was written here to sign in and out checking our timekeeping. This is done using by checking which domain user is logged into the PC. I'll find out how it's done if that is what you need to know.
Lowland
April 17th, 2001, 11:42 AM
That would be great.
Thanks a lot!!!