I am adding to an existing query that searches a database and compiles an Excel report using VBA program. The database is a Vantage database. The code is as follows:
Sql$ = "SELECT RcvDtl.PartNum, RcvDtl.PartDescription, RcvDtl.OurQty, RcvDtl.PONum, RcvDtl.ReceiptDate, PORel.DueDate, Vendor.VendorID "
Sql$ = Sql$ & "FROM vantage.PORel PORel, vantage.RcvDtl RcvDtl, vantage.Vendor Vendor "
Sql$ = Sql$ & "WHERE PORel.Company = RcvDtl.Company AND PORel.POLine = RcvDtl.POLine AND PORel.PONum = RcvDtl.PONum AND PORel.PORelNum = RcvDtl.PORelNum AND Vendor.Company = PORel.Company AND Vendor.Company = RcvDtl.Company AND Vendor.PurPoint = RcvDtl.PurPoint AND Vendor.VendorNum = RcvDtl.VendorNum AND (Vendor.GroupCode='02') AND ((RcvDtl.ReceiptDate>={d '" & start_date$ & "'}) AND (RcvDtl.ReceiptDate<={d '" & end_date$ & "'}) AND (Vendor.VendorID>='" & from_id$ & "') AND (Vendor.VendorID<='" & to_id$ & "')) "
Don't be alarmed by the size of the query, it works fine until I add the parameter (Vendor.GroupCode='02') , It doesn't actually fail it just keeps going til I kill it off. Anyone any ideas?? GroupCode is a character variable and Vendor.GroupCode='02' works fine through report builder, I'm baffled!!
Sql$ = "SELECT RcvDtl.PartNum, RcvDtl.PartDescription, RcvDtl.OurQty, RcvDtl.PONum, RcvDtl.ReceiptDate, PORel.DueDate, Vendor.VendorID "
Sql$ = Sql$ & "FROM vantage.PORel PORel, vantage.RcvDtl RcvDtl, vantage.Vendor Vendor "
Sql$ = Sql$ & "WHERE PORel.Company = RcvDtl.Company AND PORel.POLine = RcvDtl.POLine AND PORel.PONum = RcvDtl.PONum AND PORel.PORelNum = RcvDtl.PORelNum AND Vendor.Company = PORel.Company AND Vendor.Company = RcvDtl.Company AND Vendor.PurPoint = RcvDtl.PurPoint AND Vendor.VendorNum = RcvDtl.VendorNum AND (Vendor.GroupCode='02') AND ((RcvDtl.ReceiptDate>={d '" & start_date$ & "'}) AND (RcvDtl.ReceiptDate<={d '" & end_date$ & "'}) AND (Vendor.VendorID>='" & from_id$ & "') AND (Vendor.VendorID<='" & to_id$ & "')) "
Don't be alarmed by the size of the query, it works fine until I add the parameter (Vendor.GroupCode='02') , It doesn't actually fail it just keeps going til I kill it off. Anyone any ideas?? GroupCode is a character variable and Vendor.GroupCode='02' works fine through report builder, I'm baffled!!