Runtime Error 2147217900 (80040e14) – Syntex Error (Missing Operator) in query expression

20 pts.
Tags:
Microsoft Access
Syntax errors
Visual Basic 6
Visual Basic Runtime
Sir, I am using VB6 as fronthand and Access database as backend. Now in my project i want to display only those records which match selected value through combobox. but when executing system giving error as "Runtime Error 2147217900 (80040e14) - Syntex Error (missing Operator)in query expression " My code is as under Private Sub CmdGetBill_Click() '>>> find the bill details '>>> find the bill by Customer Name AddEdit = "" If CmdGetBill.Caption = "&Get Bill" Then cboCompany.Enabled = True Call ClearField cboCompany.BackColor = vbYellow cboCompany.SetFocus CmdGetBill.Caption = "&Find" Else Dim Rs1 As New ADODB.Recordset If Rs1.State = adStateOpen Then Rs1.Close End If Rs1.Open "select * from bill where bill.customer_name = " & cboCompany.Text & "'", Cn, adOpenStatic, adLockReadOnly If Rs1.RecordCount > 0 Then '>>> show details from bill table DtDate.Value = Rs1("invoice_date") TxtLocation.Text = Rs1("location") TxtChalanNo.Text = Rs1("chalan_no") cboCompany.Text = Rs1("customer_name") LblTotalAmount = Rs1("total_amt") Please help me to solve this problem

Answer Wiki

Thanks. We'll let you know when a new response is added.

A single quote is missing before the concatenation of cboCompany.Text:

“select * from bill where bill.customer_name = <b>’</b>” & cboCompany.Text & “‘”, Cn, adOpenStatic, adLockReadOnly

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following