Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

[b]Using Environ("USERNAME")[/b]

Status
Not open for further replies.

Jean9

Programmer
Dec 6, 2004
128
US
I am using UCase(Environ("USERNAME")) to gather the information and use it as a default value for a control on a form. I coded Me.OPERATOR.DefaultValue = UCase(Environ("USERNAME")) in the OnOpen event but when the form is opened the #Name? is in the control. What am I missing?
Thanks for your help,
J9
 
Perhaps OnLoad rather than OnOpen.

Let them hate - so long as they fear... Lucius Accius
 
Hi Jean9,

I have a desktop and a laptop, both running Access 2003 on Windows XP Pro SP2. On the laptop, Environ("Username") works fine, on the desktop I get #Name. I have no idea why except that my desktop is in pretty bad shape over all. Try running your DB on a different machine to see if it's your code or something else...

Jason
 
Does it still throw the error without the UCase; just Environ("UserName")? Is the control's name the same as the underlying field? Perhaps rename it txtOperator, or something along those lines.

Let them hate - so long as they fear... Lucius Accius
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top