Windows Username in Table

Rene Lazaro

New member
Local time
Today, 06:24
Joined
Jun 1, 2009
Messages
9
Good morning,

I employ a function that obtains the windows username and use fGetUserName() on forms to obtain it. This works great, however, when I insert fGetUserName() into the Default Value property of a field in my table, I get a message stating that the function is unknown.

How can I insert fGetUserName() into the default value property so that it creates a stamp of the windows username every time a new record is added?

As always, thanks for your help,

Rene
 
Good morning,

I employ a function that obtains the windows username and use fGetUserName() on forms to obtain it. This works great, however, when I insert fGetUserName() into the Default Value property of a field in my table, I get a message stating that the function is unknown.

How can I insert fGetUserName() into the default value property so that it creates a stamp of the windows username every time a new record is added?

As always, thanks for your help,

Rene

You have to insert it via code with a form. I have found that there are few functions that work in the default (Now, Date are two of them). Custom functions don't seem to want to work there.
 
Have you tried declaring a public string function in a general module such that you call this function, it calls fGetUserName(), and then just pass back the answer?

I'm not sure about fGetUserName(). Is it a new Access function or something that is actually a Windows function? Typically, the latter needs an in-Access entry point to use it.
 
Have you tried declaring a public string function in a general module such that you call this function, it calls fGetUserName(), and then just pass back the answer?
I've noticed that any kind of function (even if marked as public in a standard module) does not work in the table default. It can in a CONTROL's default, but not at table level.
 
Yes; fGetUserName is called from a public function I have declared in a module. In light of some research I've done on the issue, I will opt for Bob's solution - insert it with a form - which I was trying to avoid. Guess there's no way around it.

Thanks for your help!
 

Users who are viewing this thread

Back
Top Bottom