I have just been dumped with this problem and would appreciate any help. In the company there is already a password login system setup, i say this but it actually doesn't work!!
We have a table created with all the employees listed and their passwords, also if they have 'edit' or 'read' access. A module has also been created, here is the coding:
Option Compare Database
Option Explicit
Dim db As Database
Dim rsPasswords As Recordset
Dim strCriteria As String
Public strUserName As String
Function Security(strPassword As String) As Boolean
Security = True
Set db = CurrentDb
Set rsPasswords = db.OpenRecordset("Passwords", dbOpenDynaset)
strCriteria = "Password Like '" & strPassword & "'"
rsPasswords.FindFirst strCriteria
If rsPasswords.NoMatch Then
Security = False
Exit Function
Else
strUserName = rsPasswords!UserName
'strBusinessUnit = rsPasswords!BusinessUnit
Select Case rsPasswords!Permission
Case "Database Administrator"
DoCmd.OpenForm "frmSwitchboardDBAdmin"
Security = True
'Case "Application Administrator"
'DoCmd.OpenForm "frmSwitchboardApplicationAdmin"
Case "Edit"
DoCmd.OpenForm "frmSwitchboard"
Security = True
Case "Read"
DoCmd.OpenForm "frmSwitchboard"
Security = True
End Select
End If
End Function
'************************************
' used for data ownership security
Function UserName()
UserName = strUserName
End Function
Not too sure where to start, maybe the coding needs to be changed in some way??? Any help would be excellent,
cheers
Paul
We have a table created with all the employees listed and their passwords, also if they have 'edit' or 'read' access. A module has also been created, here is the coding:
Option Compare Database
Option Explicit
Dim db As Database
Dim rsPasswords As Recordset
Dim strCriteria As String
Public strUserName As String
Function Security(strPassword As String) As Boolean
Security = True
Set db = CurrentDb
Set rsPasswords = db.OpenRecordset("Passwords", dbOpenDynaset)
strCriteria = "Password Like '" & strPassword & "'"
rsPasswords.FindFirst strCriteria
If rsPasswords.NoMatch Then
Security = False
Exit Function
Else
strUserName = rsPasswords!UserName
'strBusinessUnit = rsPasswords!BusinessUnit
Select Case rsPasswords!Permission
Case "Database Administrator"
DoCmd.OpenForm "frmSwitchboardDBAdmin"
Security = True
'Case "Application Administrator"
'DoCmd.OpenForm "frmSwitchboardApplicationAdmin"
Case "Edit"
DoCmd.OpenForm "frmSwitchboard"
Security = True
Case "Read"
DoCmd.OpenForm "frmSwitchboard"
Security = True
End Select
End If
End Function
'************************************
' used for data ownership security
Function UserName()
UserName = strUserName
End Function
Not too sure where to start, maybe the coding needs to be changed in some way??? Any help would be excellent,
cheers
Paul