How to grab the NT Logon and use it for tracking changes to record

  • Thread starter ThriftyFinanceGirl
  • Start date
T

ThriftyFinanceGirl

How do you grab the current user logon id, etc and can I then use that to
track record changes etc. I have never done record level tracking, so this
is a new one for me.

An overview of what you would do to facilitate this would be great. I have
a table setup to keep track of the changes, but not sure what should be in
it... should I use the same table for tracking all the record changes that I
need, or should I have a tracking table for EACH table that I need to track
record changes?

Also, I don't want to use Access security because it is just not very well
accepted here at all, so how can I get a login procedure for the database
using their current Windows/NT Logon?
 
P

Piet Linden

How do you grab the current user logon id, etc and can I then use that to
track record changes etc.  I have never done record level tracking, so this
is a new one for me.

An overview of what you would do to facilitate this would be great.  I have
a table setup to keep track of the changes, but not sure what should be in
it... should I use the same table for tracking all the record changes that I
need, or should I have a tracking table for EACH table that I need to track
record changes?

Also, I don't want to use Access security because it is just not very well
accepted here at all, so how can I get a login procedure for the database
using their current Windows/NT Logon?

Here's one... gets the full name of the user
http://www.mvps.org/access/api/api0066.htm

Then there's this one, which returns the NT Logon...
http://www.mvps.org/access/api/api0008.htm
 
P

Piet Linden

How do you grab the current user logon id, etc and can I then use that to
track record changes etc.  I have never done record level tracking, so this
is a new one for me.

An overview of what you would do to facilitate this would be great.  I have
a table setup to keep track of the changes, but not sure what should be in
it... should I use the same table for tracking all the record changes that I
need, or should I have a tracking table for EACH table that I need to track
record changes?

You might want to give yourself a bit of a head start...
http://www.allenbrowne.com/AppAudit.html

Start with that and modify to suit your needs.
 
J

Jack Leach

Also, I don't want to use Access security because it is just not very well
accepted here at all, so how can I get a login procedure for the database
using their current Windows/NT Logon?

I keep a table of Users along with their passwords... after you run whatever
startup procedures in your code have the first form be a login form. If you
want the user names to be consistent with the NT user than you'll probably
want to populate your table via the API's that Piet has pointed you to, but
I'm not sure how you'd go about matching the passwords, so they will probably
need their own specific to the app.

Anyway the login form is pretty easy... a username and password control and
an OK and Cancel button. Search the Users table to verify the correct
username and then verify the password they typed (using binary compare if you
want case sensitivity). Assuming they match, throw the current user into a
global variable or property and open the form's, etc, or tell them they
screwed up and try again.

I keep an ActiveUsers table as well and don't allow more than one login from
a person on each computer. just be sure and capture the app shutdown so you
can clean up, otherwise things may be a little messy next time they open.

Let me know if you need more help...

hth

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
M

mcescher

How do you grab the current user logon id, etc and can I then use that to
track record changes etc.  I have never done record level tracking, so this
is a new one for me.

An overview of what you would do to facilitate this would be great.  I have
a table setup to keep track of the changes, but not sure what should be in
it... should I use the same table for tracking all the record changes that I
need, or should I have a tracking table for EACH table that I need to track
record changes?

Also, I don't want to use Access security because it is just not very well
accepted here at all, so how can I get a login procedure for the database
using their current Windows/NT Logon?

I would have just one table that keeps track of all the changes. I
would suggest something like this

DateChanged - When was it changed, include the time if you need it.
UserChanged - User ID of the person doing the changes.
TableChanged - Where was the record.
RecordID - Foreign key to the ID of the record that was changed.
ChangedFrom - What was the value before the update
ChangedTo - What was it changed to.
ChangedWhy - Why the change was made.

You could write a function to update this table and then call it from
your different forms as updates are made. You may not need all those
fields, but it should give you a good place to start.

Hope this helps,
Chris M.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top