-
I am trying to validate the username and password at logon.I am doing this by connecting to an access database for usuing the data control.
This is the code I used, and on the Insert statement it gives me an ERROR.
Private Sub cmdOK_Click()
Dim username As String
Dim password As String
Data1.RecordSource = " SELECT Password From Advo_Details where Password = " '" & txtPassword & "'"
Insert Into("password")
Values (txtPassword)
If txtPassword = "password" Then
frmSearch.Show
frmSearch.Show
Else
MsgBox "Credentials provided are incorrect,Please retry!", vbOKOnly, "Log in ERROR"
txtUserName.Text = ""
txtPassword.Text = ""
txtUserName.SetFocus
End If
End If
End Sub
-
Password is a string variable u have declared
u cannot use it within quotes :
Instead of ...
If txtPassword = "password" Then
try ...
If txtPassword = password Then