I have been attempting to create a log-in form. I have the code it just does not work. Could someone please look over what I have and let me know where I have made a mistake. I have pasted the code.
Private Sub Command4_Click()
'Variable Declaration Section
Dim db As Database, rs As Recordset
Dim result
Dim SQLline
'Variable Definition Section
SQLline = "SELECT * FROM tbl-first WHERE Username = [Username]AND Password =[Password];"
Set db = CurrentDb()
Set rs = db.OpenRecordset(SQLline)
'Processing Logic Section
If Username = result![Username] = [Username] And result![Password] = [Password] Then
MsgBox "Welcome!"
Else
MsgBox "Username and Password do not Match. Access Denied!"
End If
result.Close
End Sub
Private Sub Command4_Click()
'Variable Declaration Section
Dim db As Database, rs As Recordset
Dim result
Dim SQLline
'Variable Definition Section
SQLline = "SELECT * FROM tbl-first WHERE Username = [Username]AND Password =[Password];"
Set db = CurrentDb()
Set rs = db.OpenRecordset(SQLline)
'Processing Logic Section
If Username = result![Username] = [Username] And result![Password] = [Password] Then
MsgBox "Welcome!"
Else
MsgBox "Username and Password do not Match. Access Denied!"
End If
result.Close
End Sub