I have a form that needs authorization for certain of its controls. When the form opens a text control contains the users ID of the person who opened the DB, (we will call it UserID). TekTips gave me this code-thanks. I use a simple VBA code to check for specific User ID's, if they match the restricted controls become active. This check code is stored on the On Current event of the Form. This is fine if I want to change the VBA code every time a user is added or removed.
So, I built a table to store the authorized userID's The table is called Access_control. The ID's are stored in a field called "User". This way the list of user's can be administered by one of the DB users. Changes to this table are password protected and only 1 or 2 people have the password.
So, I need VBA code that runs when the form is opened should compare the forms UsetID field to the Access_control table, User field to see it it matches one of the table entries. If it matches, the restricted controls are enabled.
I am using MS Office 2013 and this DB is to be used at work.
OR...is there a better way to control access to the restricted controls?
I anxiously look forward to your replies...please include sample code.
So, I built a table to store the authorized userID's The table is called Access_control. The ID's are stored in a field called "User". This way the list of user's can be administered by one of the DB users. Changes to this table are password protected and only 1 or 2 people have the password.
So, I need VBA code that runs when the form is opened should compare the forms UsetID field to the Access_control table, User field to see it it matches one of the table entries. If it matches, the restricted controls are enabled.
I am using MS Office 2013 and this DB is to be used at work.
OR...is there a better way to control access to the restricted controls?
I anxiously look forward to your replies...please include sample code.