ms access - Cancel = True not working on form load -


On a form load event, I have this User's Access level check. If it is less than a certain threshold or has never signed in, then I have the line

  cancel = true  

However, the form Whether the load Here is the complete form load event.

  Private Sub Form_Load () IsNull (Forms! FrmUsernamePassword! TxtUserName) Then MsgBox "You must enter a user name or password.", Then vbOKOnly + vbExclamation Cancel = -1 elseif DLookup ( " [AccessLevel_ID] "," tblUsernamePasswords "," [txtUserName] = '' & amp ;! form frmUsernamePassword txtUserName & amp; " '") = 1 then MsgBox "your security level 1", vbOKOnly elseif DLookup ( "[AccessLevel_ID] "," tblUsernamePasswords "," [txtUserName] = '' & amp ;! form frmUsernamePassword txtUserName & amp; " '") = 2 then MsgBox "your security level 2", vbOKOnly elseif DLookup ( "[AccessLevel_ID]", " tblUsernamePasswords "," [txtUserName] = '' & amp ;! form frmUsernamePassword txtUserName & amp; " '") = 3 then MsgBox "your security Level 3 ", vbOKOnly elseif DLookup (" [AccessLevel_ID] "," TblUsernamePasswords "," [txtUserName] = ' "form! FrmUsernamePassword! TxtUserName & amp;"' ") = 4 then Msbibiaks" Your security level 4 "; Sorry for issuing vbOKOnly end if ending sub  

formatting.

There is no cancellation argument in form load. Use of the form to cancel the open controls content should be in the form load.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -