我有'運行時錯誤'13':類型不匹配'部分我的SQL代碼在VBA中。運行時錯誤'13':類型不匹配在SQL代碼
的代碼中的錯誤指的是:
SQL = SQL & " (select unique sv.gps_planshpdate from oes_delsegview sv, oes_opos op, oes_oposdelseg ds, oes_nrbom nb, ncf_comppart cp where cp.item_part_no = pd.part_no and nb.c_catnr = cp.catnr and nb.c_prodtyp = cp.prodtyp and nb.c_packtyp = cp.packtyp and nb.c_vernr = cp.vernr " & _
SQL = SQL & " and sv.ordnr = ds.ordnr and sv.posnr = ds.posnr and sv.catnr = nb.p_catnr and sv.prodtyp = nb.p_prodtyp and sv.packtyp = nb.p_packtyp and op.ordnr = ds.ordnr and op.posnr = ds.posnr and op.catnr = nb.p_catnr and op.prodtyp = nb.p_prodtyp and op.packtyp = nb.p_packtyp " & _
SQL = SQL & " and op.vernr = nb.p_vernr and nb.active = 'Y' and op.ol_typ in ('XX','CO') and sv.gps_planshpdate = " & _
SQL = SQL & " (select max(sv1.gps_planshpdate) from oes_delsegview sv1, oes_opos op1, oes_oposdelseg ds1, oes_nrbom nb1, ncf_comppart cp1 where cp1.item_part_no = cp.item_part_no and nb1.c_catnr = cp1.catnr " & _
SQL = SQL & " and nb1.c_prodtyp = cp1.prodtyp and nb1.c_packtyp = cp1.packtyp and nb1.c_vernr = cp1.vernr and sv1.ordnr = ds1.ordnr and sv1.posnr = ds1.posnr and sv1.catnr = nb1.p_catnr and sv1.prodtyp = nb1.p_prodtyp and sv1.packtyp = nb1.p_packtyp " & _
SQL = SQL & " and op1.ordnr = ds1.ordnr and op1.posnr = ds1.posnr and op1.catnr = nb1.p_catnr and op1.prodtyp = nb1.p_prodtyp and op1.packtyp = nb1.p_packtyp and op1.vernr = nb1.p_vernr and nb1.active = 'Y' and sv1.ord_o_status = '9' and op1.ol_typ in ('XX','CO'))), " 'last_ship_date_manufacturing
任何想法是如何沒有「類型不匹配」錯誤運行該代碼?
感謝
當我評價表情,'SQL'返回一個布爾值,'FALSE'。 FIx字符串連接,以便它計算查詢語句,而不是布爾值。 – 2014-09-30 13:58:16