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 dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enable a text box based on netowrk user id

Status
Not open for further replies.
Jan 18, 2007
39
US
I have a form that contains 25 text boxes. I want the first 12 be locked (read only) for the common user. I want to check the network log on user ID to verify who is logged into the PC/network. If it matches a particular user then that user will have full access to the form, if not a particular user then the first 12 text boxes will be read only(locked).

I know that I can set the properties of the text boxes to locked in the form load, but I am not sure how to handle the rest.

Any assistance is appreciated.

 
Unless you have still some win9x machines you may simply play with Environ("USERNAME")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV,

I am sort of butting in here but could you explain in a little more detail about how to use the Environ ("USERNAME")? Access help is very vague on this subject

Thanks,

Pufforee
 
Environ("USERNAME") returns the network log on user ID.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Would the code be something like this in the Form Load?

If Environ(username) = "abc123" or "def456" then
textbox1.locked = "No"
textbox2.locked = "No"
Else
textbox1.locked = "Yes"
textbox2.locked = "Yes"
End If

Would I need to declare any variables at some point?

Thanks!
 
If Environ("username") = "abc123" Or Environ("username") = "def456" Then

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
This worked FABULOUS!!!! A big Thank You to PHV.

Thanks again for the help and the tips!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top