"Parasyke" <kr************@yahoo.comwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
Thanks in advance for any clues here. I'm designing a simple user
log-in for a relatively low-security app that I don't want to go
through workgroups, etc. I have a login screen with a combobox to
select a user then a text box for them to put in their password. I have
a separate table set up with just the user name and the passwords as
fields. How can I write code on my log-in form to compare their name
and password entered. DLookup? Any code known that I could put in the
event for pressing the log-in button to accomplish this?
Thanks! Dav
Assuming your form is bound to the table, something like (untested):
Dim rs as DAO.Recordset, strCriteria as String
strCriteria = "[NameField] = " & Me.cboName
Set rs = Me.RecordsetClone
With rs
.FindFirst strCriteria
If ![PasswordField] = Me.txtPassword Then
'Let them in
Else
'Don't let them in
End If
End With
rs.Close
Set rs = Nothing
You might want to base your combo box on "[NameField]" so that you don't
have to handle the NoMatch situation.
HTH - Keith.
www.keithwilby.com