if with "or" statement

slimjen1

Registered User.
Local time
Today, 07:46
Joined
Jun 13, 2006
Messages
562
Hi all. Using access 2007. I have some generic code for users to logon to a database using their windows api. The only way I know to retrict a user to a form or to a record only they own is on form load.

Code:
If GetNetworkUserName <> "jdoe"  or <> "janedoe" 
then 
msgbox "you don't have permission to access this form
It only half works. If <> "jdoe" works but <> "janedoe" doesn't.
How can this code work with or?
Thanks
 
Your syntax is a little out, try;
Code:
If GetNetworkUserName <> "jdoe"  Or GetNetworkUserName <> "janedoe" Then
     msgbox "you don't have permission to access this form"
End If
 
As posted elsewhere:

Further, with the <> test, you want And rather than Or.
 
Thank you for your help. Can you tell me how I can retrict user to only their records? Do I do this the same way with the form load?
Thanks so much
 
Also; do I use "and" instead of "or" even If I want either user? With form load I want to be able to test for either user not both. If getuser <> to user1 or user 2 then.....
Thanks
 
Lets say the user is jdoe. Does that not meet the test of <> "janedoe"? Test it for yourself.
 
Ok I test it. thanks. Any idea on retricting user access to their records?
Thanks
 
Base forms on a query with a criteria.
 

Users who are viewing this thread

Back
Top Bottom