A family of Microsoft relational database management systems designed for ease of use.
Please review my blog on Login Security using VBA. it discusses such things.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
hi please advise to how to make the form as read only format for below code.
Private Sub Command1_Click() Dim UserLevel As Integer If IsNull(Me.txtLoginID) Then MsgBox "Please enter LoginID", vbInformation, "LoginID Required" Me.txtLoginID.SetFocus ElseIf IsNull(Me.txtPassword) Then MsgBox "Please enter password", vbInformation, "Password Required" Me.txtPassword.SetFocus Else 'process the job If (IsNull(DLookup("UserLogin", "tblUser", "UserLogin ='" & Me.txtLoginID.Value & "'"))) Or _ (IsNull(DLookup("password", "tblUser", "Password ='" & Me.txtPassword.Value & "'"))) Then MsgBox "Incorrect LoginID or Password" Else UserLevel = DLookup("UserSecurity", "tblUser", "UserLogin = '" & Me.txtLoginID.Value & "'") DoCmd.Close If UserLevel = 1 Then 'MsgBox "LoginID and Password correct" DoCmd.OpenForm "Navigation Form" Else If UserLevel = 2 Then (I need to make the user level 2 as read only) 'MsgBox "LoginID and Password correct" DoCmd.OpenForm "Security_DS" End If End If End If End If End Sub
A family of Microsoft relational database management systems designed for ease of use.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Please review my blog on Login Security using VBA. it discusses such things.
I would store UserLevel in a global variable. Then in the Form_Open event:
if UserLevel = 2 then
Me.AllowEdits = False
'Also consider AllowDeletions and AllowAdditions
end if