V
vandy
Hi All,
I am attempting to create my own security login screen and not use Security
Wizard
I have a table
Authorization
id- Autonumber-pk
UserID - username
Pwd - password
Level - number
Based on the level of the user the forms should be read only or full access.
I have designed a login screen with the follwoing code:
Private Sub btnlogin_Click()
Dim qplevel As Variant
If IsNull(Me.quserid) Then
MsgBox ("You Must Enter a Valid User ID !!")
Exit Sub
Else
If IsNull(Me.qpwd) Then
MsgBox ("You Must Enter a Password!!")
Exit Sub
End If
End If
If Me.qpwd.Value = DLookup("PWD", "Authorized", "UserID ='" &
Me.quserid.Value & "'") Then
DoCmd.OpenForm "MainMenu", acNormal
Else
MsgBox ("Invalid Password!Try Again!")
End If
qplevel = DLookup("[Level]", "Authorized", "[UserID] = '" & Me.quserid.Value
& "'")
If qplevel >= 2 Then
MsgBox ("Read only access")
DoCmd.OpenForm "q10"
DoCmd.OpenForm "transactionfrm", , , , acFormReadOnly
'Me.AllowEdits = False
'Me.AllowDeletions = False
'Me.AllowAdditions = False
Else
MsgBox ("full access")
'Me.AllowEdits = True
'Me.AllowDeletions = True
'Me.AllowAdditions = True
End If
End Sub
I know that to enable or disable a form you can set the AllowEdits to true
or false but how or were should i use this.
I want to be able to contol the way forms are opened. Right now the
condition is working and i am getting the correct messages but how to
selectively open the form in read only and give selective controls on some
controls on the form.
Thanks for your patience. I would appreciate your inputs and help.
I am attempting to create my own security login screen and not use Security
Wizard
I have a table
Authorization
id- Autonumber-pk
UserID - username
Pwd - password
Level - number
Based on the level of the user the forms should be read only or full access.
I have designed a login screen with the follwoing code:
Private Sub btnlogin_Click()
Dim qplevel As Variant
If IsNull(Me.quserid) Then
MsgBox ("You Must Enter a Valid User ID !!")
Exit Sub
Else
If IsNull(Me.qpwd) Then
MsgBox ("You Must Enter a Password!!")
Exit Sub
End If
End If
If Me.qpwd.Value = DLookup("PWD", "Authorized", "UserID ='" &
Me.quserid.Value & "'") Then
DoCmd.OpenForm "MainMenu", acNormal
Else
MsgBox ("Invalid Password!Try Again!")
End If
qplevel = DLookup("[Level]", "Authorized", "[UserID] = '" & Me.quserid.Value
& "'")
If qplevel >= 2 Then
MsgBox ("Read only access")
DoCmd.OpenForm "q10"
DoCmd.OpenForm "transactionfrm", , , , acFormReadOnly
'Me.AllowEdits = False
'Me.AllowDeletions = False
'Me.AllowAdditions = False
Else
MsgBox ("full access")
'Me.AllowEdits = True
'Me.AllowDeletions = True
'Me.AllowAdditions = True
End If
End Sub
I know that to enable or disable a form you can set the AllowEdits to true
or false but how or were should i use this.
I want to be able to contol the way forms are opened. Right now the
condition is working and i am getting the correct messages but how to
selectively open the form in read only and give selective controls on some
controls on the form.
Thanks for your patience. I would appreciate your inputs and help.