P
puzzled
I am trying to set up a log-in screen with UserIDs and
passwords. (Please, do NOT refer me to the database
security, it is not what I want, and I know the security
of this is limited, lol)
I have a table listing the authorized users (Useracc) and
their passwords. I have an empty table (UserID & Password
only) used as the control source for a log-in screen form.
I have managed to perform a dlookup check on the User
entered on the form back to the UserName holding table:
****************************************************
Private Sub User_BeforeUpdate(Cancel As Integer)
Dim varUserID As Variant
varUserID = DLookup("ID", "Useracc", "[UserName]=User")
If IsNull(varUserID) Then
MsgBox "This user is not recognised, please try again"
Exit Sub
End If
End Sub
*****************************************************
I have two problems:
1. I would like if when the message box is activated that
the focus shift back to the User field and not progress
through the form as if its ok really- ideally having
removed the dodgy user name as well- is this do-able?
All my attempts have resulted in errors telling me the
user field must be saved before it can get a focus- I
want it deleted, as currently if the form closes the
record still gets created.
2. I can't get a multiple criteria to look at the
password field. I've tried adding an "And..." before the
end of quotation marks in the criteria and adding the
addtional reference (ie using: UserName=User And
Password1=Password), but I'm not at all sure what exactly
goes wrong. Other examples I have seen use "&" a lot,
which I don't fathom- is it an older version of VB code?
(I also have queries that validate it all fine, but can't
work out how to reference these in the form as way to
determine an action...its been a long week and a bad day
all round...paracetamol!!)
Any assistance would be gratefully rec'd, thanx
passwords. (Please, do NOT refer me to the database
security, it is not what I want, and I know the security
of this is limited, lol)
I have a table listing the authorized users (Useracc) and
their passwords. I have an empty table (UserID & Password
only) used as the control source for a log-in screen form.
I have managed to perform a dlookup check on the User
entered on the form back to the UserName holding table:
****************************************************
Private Sub User_BeforeUpdate(Cancel As Integer)
Dim varUserID As Variant
varUserID = DLookup("ID", "Useracc", "[UserName]=User")
If IsNull(varUserID) Then
MsgBox "This user is not recognised, please try again"
Exit Sub
End If
End Sub
*****************************************************
I have two problems:
1. I would like if when the message box is activated that
the focus shift back to the User field and not progress
through the form as if its ok really- ideally having
removed the dodgy user name as well- is this do-able?
All my attempts have resulted in errors telling me the
user field must be saved before it can get a focus- I
want it deleted, as currently if the form closes the
record still gets created.
2. I can't get a multiple criteria to look at the
password field. I've tried adding an "And..." before the
end of quotation marks in the criteria and adding the
addtional reference (ie using: UserName=User And
Password1=Password), but I'm not at all sure what exactly
goes wrong. Other examples I have seen use "&" a lot,
which I don't fathom- is it an older version of VB code?
(I also have queries that validate it all fine, but can't
work out how to reference these in the form as way to
determine an action...its been a long week and a bad day
all round...paracetamol!!)
Any assistance would be gratefully rec'd, thanx