Hello,
Forum
I have a question based on login for employee to open the next form based on their IDs.
I would like to set Employee IDs 1 To 10 to openForm in normal mode and the rest to openForm in read-only mode.
Any suggestions will be helpful.
Code:
Option Compare DatabaseOption Explicit
Private Sub btnLogin_Click()
'Assigning Variables
Dim strcboPass As String
Dim strPassword As String
Dim strSection As String
Dim intID As Integer
'Setting Variables based on condition in cbobox
strcboPass = Me.cboUsername.Column(1)
strPassword = Nz(Me.txtPassword, " ")
strSection = Me.cboUsername.Column(2)
intID = Me.cboUsername.ColumnCount(0)
'Evaluate Expression whether the user is true
If strPassword = strcboPass Then
If intID 1,2,3,4,5,6,7,8,9,10 then
'Grouping them in their respective sections
Select Case strSection
Case "ELE"
DoCmd.OpenForm "frmMaster", acNormal, , , , acWindowNormal
DoCmd.Close acForm, "frmLogin"
Case "CCTV"
DoCmd.OpenForm "frmMaster", acNormal, , , , acWindowNormal
End Select
Else
MsgBox "Login UnSuccessful!"
Me.txtPassword = Null
Exit Sub
End If
End Sub