Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call Statement not functioning

Status
Not open for further replies.

samuelsisgay

Programmer
Apr 17, 2002
4
0
0
AU
Just a quickie...syntax problem
I am trying to call open a table called results, fetch data from my form and update the table with this data into a particular username and password record.(As shown, i have declared a variable to store a particular username, password).

Call rst1.Open("SELECT * FROM results where username =" & okUsername & " and password =" & okPassword, cnn, adOpenKeyset, adLockOptimistic)
With rst1
'.AddNew
.Fields("Trial1Correct").Value = txtCorrect.Text
.Fields("NoQuestions1").Value = txtTotal.Text
.Update
End With
...
I couldn't figure out the syntax problem using MSDN and etc.
SYNTAX PROBLEM: Syntax error (missing operator) in query expression 'username = and password='.
Thanks

 
Try this

Call rst1.Open("SELECT * FROM results where username ='" & okUsername & "' and password ='" & okPassword & "'", cnn, adOpenKeyset, adLockOptimistic)

Adding single quote around your variables.

Hope this helps.
If you choose to battle wits with the witless be prepared to lose.
[machinegun][ducky]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top