Limit Access to Form objects with Environ("username")

wrweaver

Registered User.
Local time
Today, 10:17
Joined
Feb 26, 2013
Messages
75
I'm trying to limit the access to certain objects on certain forms to just 3 users. I thought the code would be

If Environ("username") <> "user1" Or "user2" Or "user3" Then
object1.visible = false
object2.visible = false
object3.visible = false

End if

BUT it keeps giving me the Run-Tmie error 13 Type Mismatch error.

So then I tried If
If Environ("username") = "user1" Or "user2" Or "user3" Then
object1.visible = false
object2.visible = false
object3.visible = false

Else
object1.visible = true
object2.visible = true
object3.visible = true
End If

And I get the same error.

Any ideas on what the problem is? Thanks!
 
Ahhhhh! Yes that makes total sense! Thank you so much!!!!
 
Thanks for the advice! I think that's probably an idea I'll explore rather than go through each form writing the same code! Thanks!
 

Users who are viewing this thread

Back
Top Bottom