J
James C.
Can someone help??? I am trying to get the following code to work and keep
getting an error. The code takes a username & password input from a form,
compares it to a list of usernames and passwords in a table before allowing
the person to login.
Here is the code -------------------------------
Private Sub LoginScript()
Dim db As Database
Set db = CurrentDb()
Dim rs As Recordset
Dim strUser As String
Dim strPassword As String
txtUsername.SetFocus
strUser = txtUsername
txtPassword.SetFocus
strPassword = txtPassword
If Not IsNull(Me.txtUsername) And Not IsNull(Me.txtPassword) Then
Set rs = db.OpenRecordset("Select * from LoginSecurity where Username =
'" & strUser & "' And Password = '" & strPassword & "'", dbOpenSnapshot)
If rs.EOF Then
MsgBox ("This worked")
Else
MsgBox ("This didnot work")
End If
End If
--------------------------------------------------\
I am getting an error "Type Mismatch" when it hits the following line:
Set rs = db.OpenRecordset("Select * from LoginSecurity where Username = '" &
strUser & "' And Password = '" & strPassword & "'", dbOpenSnapshot)
Any ideas?
getting an error. The code takes a username & password input from a form,
compares it to a list of usernames and passwords in a table before allowing
the person to login.
Here is the code -------------------------------
Private Sub LoginScript()
Dim db As Database
Set db = CurrentDb()
Dim rs As Recordset
Dim strUser As String
Dim strPassword As String
txtUsername.SetFocus
strUser = txtUsername
txtPassword.SetFocus
strPassword = txtPassword
If Not IsNull(Me.txtUsername) And Not IsNull(Me.txtPassword) Then
Set rs = db.OpenRecordset("Select * from LoginSecurity where Username =
'" & strUser & "' And Password = '" & strPassword & "'", dbOpenSnapshot)
If rs.EOF Then
MsgBox ("This worked")
Else
MsgBox ("This didnot work")
End If
End If
--------------------------------------------------\
I am getting an error "Type Mismatch" when it hits the following line:
Set rs = db.OpenRecordset("Select * from LoginSecurity where Username = '" &
strUser & "' And Password = '" & strPassword & "'", dbOpenSnapshot)
Any ideas?