Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Appending user name from the system to a table

Status
Not open for further replies.

apoena

Technical User
Feb 28, 2001
14
US
I have a code where I get the user name from windows using the "GetUserNameA" deal. From that I want to append (or create) that to a table.... and that's where I'm getting frustrated. I can't seem to work the "CreateTableDef" command right - if that's even what I should be using.

My final goal is to keep track of who is using my db and for how long without a login box. So I was going to have a code that keeps track of who opened the db and when, and also when they closed it. From that I could calculate what I want. If you can think of a better way of doing that, I'm all ears :)

Thanks in advance
Apoena Becker
 
you could place this code somewhere assuming you have a table created, say USERS.

dim db as dao.database
dim rs as dao.recordset

set db = currentdb
set rs = db.openrecordset("users",dbopendynaset)

rs.addnew
rs.fields(0) = GetUserNameA
rs.fields(1) = now()
rs.update

Nick
 
apoena,

nickjar's approach will get you some of the info. I do not know of any way to know that a user has logged off the database without Ms. Access security. Even with it (Ms. Access Security) it requires significant resource usage. It is possible to use the network log-pn as the user name with Me. Access security. Using this - and some trickery with the passwords, you can use Ms. Access Security and not have users SEE the logon process. Since most of my customer's do not want the security, I do not rember this process in sufficient detail to post it here, but I have done it on a few occassions and know that it can be done.


MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top