strSelect = "select RawGoods.code, RawGoods.name, RawGoods.unit, lastweight, lastsubtotal, inweight, insubtotal, currentweight, currentsubtotal, lostweight, lostsubtotal" _
        & " from UsedTemp left join lastTemp ON UsedTemp.code = lastTemp.code left join inTemp ON UsedTemp.code = inTemp.code" _
       & " left join currentTemp ON UsedTemp.code = currentTemp.code left join lostTemp ON UsedTemp.code = lostTemp.code" _
       & " left join RawGoods ON UsedTemp.code = RawGoods.code" _
       & " order by UsedTemp.code"运行的时候显示操作符丢失,左连接如果只连一张表,就可以显示
像上面连上几张表就不行了,是否需要加入什么分隔符号或是语法有错呢
还请高手指点

解决方案 »

  1.   

    是ACCESS数据库吧,ACCESS数据库的关联如果是多个,要用括号括起来!!strSelect = "select RawGoods.code, RawGoods.name, RawGoods.unit, lastweight, lastsubtotal, inweight, insubtotal, currentweight, currentsubtotal, lostweight, lostsubtotal" _
            & " from ((((UsedTemp left join lastTemp ON UsedTemp.code = lastTemp.code left join inTemp ON UsedTemp.code = inTemp.code)" _
           & " left join currentTemp ON UsedTemp.code = currentTemp.code) left join lostTemp ON UsedTemp.code = lostTemp.code)" _
           & " left join RawGoods ON UsedTemp.code = RawGoods.code)" _
           & " order by UsedTemp.code"你自己调试一下,最好将SQL语句输出,然后到查询分析器中执行!!!
      

  2.   

    我试过把括号放在后面,就显示FROM后有语法错误
    刚试了下你的方法,似乎可以
    可以说说为什么要放在前面吗,括号!!
      

  3.   

    Access数据SQL语句的限制!不过这样可以让结构更清晰啊!