User network login

T

Tony WONG

Dear All

I wish all the Forms in access 2007 to use the network user name.

How should i put this code in the Access form for the best performance?

++++++++++++++++
Dim objNet, DataUser
Set objNet = CreateObject("WScript.NetWork")
DataUser = objNet.UserName
++++++++++++++++

Thanks a lot.

Tony
 
D

Douglas J. Steele

Personally, I'd use the function from
http://www.mvps.org/access/api/api0008.htm at "The Access Web": I'd expect
it to be at least an order of magnitude faster.

I'd have a form that opens up when you open the application and stays open
the entire time the application's open (whether or not it's visible) and
store the value as a field on that form. In that way, you can refer to
Forms!NameOfForm!NameOfControl from everywhere in your application.
 
Top