Runtime Error 2147217900 (80040e14) - Syntex Error (Missing Operator) in query expression
20 pts.
0
Q:
Runtime Error 2147217900 (80040e14) - Syntex Error (Missing Operator) in query expression
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
ASKED: May 26 2009  10:09 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
29855 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
A single quote is missing before the concatenation of cboCompany.Text:

"select * from bill where bill.customer_name = '" & cboCompany.Text & "'", Cn, adOpenStatic, adLockReadOnly
Last Answered: May 26 2009  1:39 PM GMT by Carlosdl   29855 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



0