Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think what you need to do is simpler than you think.</p> <p>Just do an if statement in the form load of the <code>MainMenu_FRM</code> that only enables the buttons for admins and set the default so that it's disabled for everyone else. Then only admins can click it.</p> <p>Why don't admins have to login as well? Just have them login, and set their permissions appropriately after they log in.</p> <p>i.e. Set every button on <code>MainMenu_FRM</code> to <code>Enabled = no</code> in properties.</p> <pre><code>Private Sub Form_Load() '****Admin**** If strUserAccess = "Admin" Then Me.buttonThatTakesYouSomewhere.Enabled = True Me.buttonThatTakesYouSomewhereElse.Enabled = True '****USER**** ElseIf strUserAccess = "User" Then Me.buttonThatTakesUsersSomewhere.Enabled = True Me.buttonThatTakesUsersSomewhereElse.Enabled = True end if end sub </code></pre> <p>Also, for security reasons, make sure you password your code and disable shift override so nobody can break anything. </p> <p>Use a DLookup based on their login name (which you can set as a tempvar on the login screen) to find their access level from the table.</p> <p>per your second part from the comments. I've never called a temp var in a dlookup, so I can only take a stab at it. You might need to google how to do it correctly if it doesn't work. It could need more or less quotation marks.</p> <pre><code>dim strUserAccess as String strUserAccess = DLookup("fieldname", "tablename", "[UserName]="" &amp; TempVars("Username").value &amp; "") if strUserAccess = "Admin" then ... </code></pre> <p>and so on. I may have typoed the Dlookup, and I'm not 100% sure that this will even work, but it should do. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload