sql="slelect * from t_A Ta,t_B Tb,t_C Tc when Ta.CusId=Tb.ID And      Ta.BookID=Tc.ID and Td.Cus='" & Cus & "' " 
set rs=getrecordset(sql)
txtID.text = rs("Tc.id")
那里有问题,请大家帮帮忙.

解决方案 »

  1.   

    你的SQL语句里面找不到Td所在的表,当然有问题了。
      

  2.   

    sql = "Select * from t_A Ta,t_B Tb, t_C Tc where Ta.t_Cus=Tb.id and Ta._Book=Tc.id and Tb.t_Cus='" & Customer & "' "
    这一句
      

  3.   

    sql语句改为
    sql="select * from t_A Ta,t_B Tb,t_C Tc " _
     & "where Ta.CusId=Tb.ID And Ta.BookID=Tc.ID and Td.Cus='" & Cus & "' " _
      

  4.   

    sql = "Select * from t_A Ta,t_B Tb, t_C Tc where Ta.t_Cus=Tb.id and Ta._Book=Tc.id and Tb.t_Cus='" & Customer & "' "
    不好意思,刚才打错了,是这一句.
      
      

  5.   

    sql=" select * from t_C " _
     & " inner join t_A on  t_A.BookID=t_C.ID " _
     & " inner join t_B on t_A.CusId=t_B.ID " _
     & " where t_B.t_Cus='" & Customer & "'"
      

  6.   

    sql = "Select Tc.id as TCID from t_A Ta,t_B Tb, t_C Tc where Ta.t_Cus=Tb.id and Ta._Book=Tc.id and Tb.t_Cus='" & Customer & "' "txtID.text = rs("TCID")
      

  7.   

    txtID.text = rs("Tc.id")
    '有错,改为
    txtID.text=rs.fields("Tc.id")
      

  8.   

    sql語句出錯了,你想用哪個表的id?因為幾個表裡都有id,所以你在select 裡應該指明是哪個表的id,
    如:select Tc.id from...txtID.text = rs("Tc.id")
      

  9.   

    sql = "Select Tc.id as id from t_A as Ta,t_B as  Tb, t_C as  Tc where Ta.t_Cus=Tb.id and Ta._Book=Tc.id and Tb.t_Cus='" & cstr(Customer) & "' "'如果 Customer 为数值型,则要用 Cstr() 将其转化为字符型,否则报错set rs=getrecordset(sql)
    txtID.text = rs("id")