G
Guest
I'm new to ACCESS 2002 and I have a question on a string. I have a password box that requests the user to enter a password. If they enter a password the process works but if the password box is left empty it fails. I have the code below. Thanks for your help
This is in a module that calls the frmpassword form which then requests a password. If the password is correct it gives them access to another form
DoCmd.OpenForm "frmpassword", , , , , acDialog 'open form to enter passwor
strPassword = Forms!frmpassword!txtpwd 'Retrieve the password that was entered
'This shows me if I enter the password but not if it is empt
' It will fail if the box stays empty
' showme = Len(strPassword
'Does the password match if yes then open the frmDataEntry form
If Len(strPassword) > 0 The
If strPassword = "password" The
DoCmd.OpenForm "frmDataEntry
strPassword = "default
Els
MsgBox "Incorrect Password
End I
End I
Els
DoCmd.OpenForm "frmDataEntry
End I
This is in a module that calls the frmpassword form which then requests a password. If the password is correct it gives them access to another form
DoCmd.OpenForm "frmpassword", , , , , acDialog 'open form to enter passwor
strPassword = Forms!frmpassword!txtpwd 'Retrieve the password that was entered
'This shows me if I enter the password but not if it is empt
' It will fail if the box stays empty
' showme = Len(strPassword
'Does the password match if yes then open the frmDataEntry form
If Len(strPassword) > 0 The
If strPassword = "password" The
DoCmd.OpenForm "frmDataEntry
strPassword = "default
Els
MsgBox "Incorrect Password
End I
End I
Els
DoCmd.OpenForm "frmDataEntry
End I