Hello Experts,
I want to ammend below VBA in a way that it should check the user name and open
the form accordingly. Below is the code i got from google, but it works only for one form.
Example:
If user : Abalkhair log-in then he should be able to see only form ABC1
Private Sub BtnLogin_Click()
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("Login", dbOpenSnapshot, dbReadOnly)
rs.FindFirst "UserName='" & Me.TxtUserName & "'"
If rs.NoMatch = True Then
Me.LblWrongUser.Visible = True
Me.TxtUserName.SetFocus
Exit Sub
End If
Me.LblWrongUser.Visible = False
If rs!Password <> Me.TxtPassword Then
Me.LblWrongPass.Visible = True
Me.TxtPassword.SetFocus
Exit Sub
End If
Me.LblWrongPass.Visible = False
DoCmd.OpenForm "Report Form"
DoCmd.Close acForm, Me.NAME
End Sub