Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27514

VS 2010 Creating a partition for Access Login

$
0
0
I'm looking to, based on User's class, redirect them to different forms upon logging in. Any help is much appreciated!

Option Compare Database
Private intLogonAttempts As Integer

Private Sub cboUser_AfterUpdate()
txtUserClass = cboUser.Column(2)
End Sub

Private Sub cmdExit_Click()
DoCmd.Quit
End Sub

Private Sub cmdLogin_Click()
'Check to see if data is entered into the UserName combo box
If IsNull(Me.cboUser) Or Me.cboUser = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.cboUser.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPassword.SetFocus
Exit Sub
End If
'Check value of password in tblEmployees to see if this matches value chosen in combo box
If Me.txtPassword.Value = DLookup("UserPassword", "tblUser", "[UserID]=" & Me.cboUser.Value) Then
MyUserID = Me.cboUser.Value
'Close logon form
DoCmd.Close acForm, "frmLogin", acSaveNo
'Open form based on User Class
DoCmd.OpenForm "ClientHome"
Else
MsgBox "Password Invalid. Please Try Again", vbCritical + vbOKOnly, "Invalid Entry!"
Me.txtPassword.SetFocus
End If
'If User Enters incorrect password 3 times database will shutdown
intLogonAttempts = intLogonAttempts + 1
If intLogonAttempts > 3 Then
MsgBox "You do not have access to this database. Please contact your system administrator.", vbCritical, "Restricted Access!"
Application.Quit
End If
End Sub

Viewing all articles
Browse latest Browse all 27514

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>