thcode said:
Ok I have changed the name of the module to modOSUserName
I need an audit trail of who was logged into the machine when the record
was
input so I need this added to the table for reports.
So I put the =modOSUserName() in what?
Not "=modOSUserName", "=fOSUserName()" -- assuming that's the name of the
function *in* the module. The module is just the container for the
function. It's the function you actually call by name.
Have you crewated a text field in your table to hold the user name?
Assuming you have, then add a text box to the entry form, bound to that
field, and set the Default Value property of the text box to
=fOSUserName()
If you don't want the user to be able to see the text box, you can set the
text box's Visible property to No, and make the text box as small as you
want.
The Default Value property set as above will cause the user name to
aautomatically be inserted into any new record that is added with that form.
It won't track who updated the record later, though, unless you also add
code to the form's BeforreUpdate event, along these lines:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me!txtUserName = fOSUserName()
End Sub
Note: if you have code like that, you don't need to set the Default Value
property.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)