Hi,
I am using Vb 6 and Access.
I am getting syntax error in the following sql query.
strSql = "SELECT tblInvoice.Proj ID,tblInvoice.C usID,tblInvoice .InvoiceNo,tblI nvoice.InvDate, tblInvoice.Tota l,tblInvoice.Pa id,tblInvoice.B alance,tblCusto mer.CustomerNam e FROM tblCustomer RIGHT JOIN tblInvoice ON tblCustomer.Cus ID=tblInvoice.C usID WHERE tblInvoice.InvD ate >= #" &sDate& "# AND tblInvoice.InvD ate <= #" &eDate& "# AND tblCustomer.Cus tomerName='" & cboCustomer.Tex t & "' AND tblInvoice.Proj ID=" & projectID & "AND Balance >0"
Can anyone one point out whats the mistake I am making here?
When I substitute dates instead of the variables, there is no error and the query executes perfectly.
Thanks for ur time.
I am using Vb 6 and Access.
I am getting syntax error in the following sql query.
strSql = "SELECT tblInvoice.Proj ID,tblInvoice.C usID,tblInvoice .InvoiceNo,tblI nvoice.InvDate, tblInvoice.Tota l,tblInvoice.Pa id,tblInvoice.B alance,tblCusto mer.CustomerNam e FROM tblCustomer RIGHT JOIN tblInvoice ON tblCustomer.Cus ID=tblInvoice.C usID WHERE tblInvoice.InvD ate >= #" &sDate& "# AND tblInvoice.InvD ate <= #" &eDate& "# AND tblCustomer.Cus tomerName='" & cboCustomer.Tex t & "' AND tblInvoice.Proj ID=" & projectID & "AND Balance >0"
Can anyone one point out whats the mistake I am making here?
When I substitute dates instead of the variables, there is no error and the query executes perfectly.
Thanks for ur time.
Comment