password form not working need help

  • Thread starter Thread starter Michael Hanlon
  • Start date Start date
M

Michael Hanlon

listed below is the code i have written that is not working any help would
be great if you can show me where i went wrong as i am new to this side.
thanks in advance.

Private Sub cmdlogin_Click()

'Check to see if data is entered into the UserName combo box

'If IsNull(Me.cbousername) Or Me.cbousername = "" Then
'MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
'Me.cbousername.SetFocus
'Exit Sub
'End If

'Check to see if data is entered into the password box

'If IsNull(Me.txtpassword) Or Me.txtpassword = "" Then
'MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
'Me.txtpassword.SetFocus
'Exit Sub
'End If

'Check value of password in usyspassword to see if this
'matches value chosen in combo box

'If Me.txtpassword.Value = DLookup("Password", "usyspassword", "[ID]=" &
Me.cbousername.Value) Then

'ID = Me.cbousername.Value
'GoTo Choose:
'Else
'MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
'Me.txtpassword.SetFocus
'End If

'If User Enters incorrect password 3 times database will shutdown

'intLogonAttempts = intLogonAttempts + 1
'If intLogonAttempts > 3 Then
'MsgBox "You do not have access to this database.Please contact admin.",
vbCritical, "Restricted Access!"
'Application.Quit
'End If


'Choose:
'Close logon form and open splash screen
'If Me.cbousername.Value = "admin" Then
'DoCmd.Close
'DoCmd.OpenForm "pers", acNormal, , "[group] = 1"
'ElseIf passwd = "b" Then
'DoCmd.Close
'DoCmd.OpenForm "pers", acNormal, , "[group] = 2"
'ElseIf passwd = "c" Then
'DoCmd.Close
'DoCmd.OpenForm "pers", acNormal, , "[group] = 3"
'Else
'DoCmd.Close
'DoCmd.OpenForm "pers", acNormal, , "[group] = 4"
'End If



'Exit_cmdlogin_Click:
' Exit Sub

End Sub
 
Hi Michael

I hope I'm not stating the obvious, but every line of code in this procedure
has been commented out. Is this intentional?

Also, if you really want to implement security in your database, you should
do it with the workgroup security facility. I suggest you have a look as
the FAQ at http://support.microsoft.com/?kbid=207793
 
If Me.txtpassword.Value = DLookup("Password", "usyspassword", "[ID]= ' " &
Me.cbousername.Column(0) & " ' ") Then

Note that I have added spaces around the single quotes.

You do understand that the password scheme that you've adopted provides
absolutely no real security?
 
Back
Top