Help with Allen Brown's (wonderful!) audit trail code.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I used Allen Brown's instructions for creating an audit trail. It works
very, very well (thank you, Allen!). It shows the type of audit, date/time
audit occurred, and the network username of the person who inserted, updated,
or deleted a record.

I would like to add a few more things, though, and have no idea how to do
this. I want to add: 1) network full name (in addition to network username),
database username, and machine name.

How do I do this?
 
The database use name is given by:
CurrentUser()

The machine name is here:
http://www.mvps.org/access/api/api0009.htm

Not sure what you mean by the network full name.
And potentially the person could be on multiple networks?
You could try opening a Windows command prompt, and entering:
SET
If you see the name there, you be able to use Environ()
 
Thank you, Allen :-). I'm not sure how to incorporate it into the audit
trail code I got from you, though. That is, I already have the code for the
other (current user, machine name, etc.) but when I try to add it to the
audit trail code, I get error messages saying something like "the input query
must have a query or table" (or something like that. So I know I'm doing
something wrong, and think it must be something really simple, but I'm not
getting it. I'm very new at this and not sure how to add to the existing
audit trail code to make it all work right.
 
You will need to add the fields to both the audit table, and also the temp
table.

Then you will need to modify the Append query statements so they include
these fields as well. Be careful to maintain the same order, and to include
the quote delimiters around the string values.
 
I know this seems goofy, but I am just stuck. Here are the functions I want
to add in the audit trail module:

fOSMachineName() (to return machine name)
fGetFullNameofLoggedUser() (to get first and last name as listed on network
server)
fOSUserName() (database username)

I added the following fields to both temp audit and audit tables:
audMachine
audFullName
audDBUser

Is there any way possible you could show me an example of the code that
would go in the audit trail module, with the above functions included? I am
so new to this I don't even know vb -- I'm just a good copier...... Thanks
soooo much for your time here.
--Janet
 
Janet, I'm not able to provide free support for all the free stuff at the
website.

What we try to do here is to give you incentive to learn for yourself,
rather than just give you things to copy. Heh, some of the stuff you learn
could be really useful. ;-)
 
Back
Top