D
David W. Fenton
I have not changed the name of the Module other then the default,
Module1...the function part of the module was automatically named
fOSUsername...and if i use the controll source in a unbound
textfield = fOSUername ()..it does return the correct value...is
there any other way to bypass this problem...the update event
functions well for date and time...so i know when the record was
last edited..but not by whome..
Well, for one, in what you posted:
you misspelled the name of your function. I don't know where you
copied that from, but it ought to throw an error in code, unless you
don't have Option Explicit in the module where you're calling it.
For what it's worth, I use a wrapper function around the function
that makes API call to get the user logon because I think it's
senseless to ask Windows the user logon every time you need to
record it -- it certainly can't change within a single Access
session. So I use the function posted after my signature.
For the function you're using, you'd replace "fGetUserName" with
your function name, "fOSUername". What that code does is it calls it
once and stores it in the Static variable. As long as the Static
variable remains live, it will return the variable and not bother to
ask the OS again.
--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Public Function UserLogon() As String
Static strUserLogon As String
If Len(strUserLogon) = 0 Then
strUserLogon = fGetUserName()
End If
UserLogon = strUserLogon
End Function