将strQuery="select * from customers,orders where & _
"customers.客户号)=orders.客户号 & _
"and customers.客户号=" & dcborderno.boundtext 
改为

strQuery="select * from customers,orders where customers.客户号=orders.客户号 and customers.客户号= &'" dcborderno.boundtext "'&" 

解决方案 »

  1.   

    写错了:
    应该是
    strQuery="select * from customers,orders where customers.客户号=orders.客户号 and customers.客户号= '"& dcborderno.boundtext &"'"
      

  2.   

    strQuery="select * from customers,orders where customers.客户号=orders.客户号 and customers.客户号='" & dcborderno.boundtext & "'"
      

  3.   

    strQuery = "select * from customers,orders where" & _
               " customers.客户号 = orders.客户号 " & _
               "and customers.客户号= " & dcborderno.boundtext 注意引号和括号的位置!!另外,如果  .客户号 是定义的 vbtext 类型,在sql语句里要在字段两边加单引号!
      

  4.   

    strQuery="select * from customers,orders where customers.客户号=orders.客户号 and customers.客户号='" & dcborderno.boundtext & "'"
    完全正确
      

  5.   

    strQuery="select * from customers,orders where customers.客户号=orders.客户号 and customers.客户号='" & dcborderno.boundtext & "'"