Question:
Im using VB6 and Access 2003 - Syntax error (missing operator) in query expression?
Jayjar
2011-05-01 04:52:34 UTC
Im using VB6 and Access 2003 -
when i enter search for number Syntax error (missing operator) in query expression 'billno=' it comes
code is as follows
Dim X
On Error Resume Next
P = InputBox("ENTER NUMBER FOR SEARCH", "SEARCH")
Adodc1.ConnectionString = ss
SQL = " SELECT * FROM BILL where billno = " & X
'MsgBox sql
Adodc1.RecordSource = SQL
Adodc1.Refresh
MSHFlexGrid1.Visible = True
Option2.Value = False

please help me to find this error
Four answers:
2011-05-01 05:16:32 UTC
I think your SQL statement is miss ' ' operator like that "SELECT * FROM BILL where billno = ' " & X & " ' "

Example SQL statement ( SELECT * FROM BILL where billno='B-1'). So you should put single code operator( ' ' ) follow the equal sign( = ' ). If you don't do that you already put single code( ' ' ) operator while you run your program like that 'B-1'
TheMadProfessor
2011-05-02 07:56:58 UTC
First off, you don't define P anywhere...systax suggests you meant X instead.



Secondly, you didn't terminate the quesry string properly...at a minimum you need to append a closing space (and possibly a semicolon..don't recall if Access requires one offhand but many DBMS do)



Thirdly, is billno a numeric field or varchar? If the former, you might have to cast X to numeric; if the latter, X needs to be embedded in single quotes.
rue
2016-10-19 12:40:25 UTC
No, yet i did attempt and fairly some cases to consume soup with a spoon, rather if a soup is thick (you could thicken the soup effectively with the help of including some flour). It takes extra time, so I take exhilaration in it longer
Serge M
2011-05-01 13:03:30 UTC
Maybe P==>X:



X = InputBox("ENTER NUMBER FOR SEARCH", "SEARCH")


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...