Help with query string

V

viktor

here my string:
querystring = "SELECT DISTINCT item_id FROM p21_view_invoice_hdr_salesrep
as b,p21_view_invoice_line As a "
querystring = querystring & "WHERE invoice_no = invoice_number AND
a.date_created> " & DateStart & " "
querystring = querystring & "and a.date_created<" & DateEnd & " "
querystring = querystring & " AND b.salesrep_id= " & SalesRep & " "
querystring = querystring & "AND (cogs_amount<>$0)

this is my query string and it's not returning anything. when i look my
trace the parametera doesn't have a single qoutes. when i add ' to the start
and end of the value they are geting two single qoutes. like this

SELECT DISTINCT item_id FROM p21_view_invoice_hdr_salesrep as
b,p21_view_invoice_line As a WHERE invoice_no = invoice_number AND
a.date_created>'' 1/1/2005'' and a.date_created<''4/1/2005 '' AND
b.salesrep_id= 1004 AND (cogs_amount<>$0)

any help please
 
Top