sql="select num,'  ' a,'  'b,'  'c from chn_name where ……"
rs.open sql,data.data1Do While Not rs.EOFsql="select day,day1,day2  from info_v where num='rs(0)' and  ……"
rs1.open sql,data,data1if not rs1.eof then
   rs(1)=rs1(0) '赋值 
else 
   rs(1)=0……………………
*****************
rs(1)=rs1(0) '赋值 在此句出现错误【对象或者提供者不能执行所需的操作】
由于这个表的查询设计到,即使某人的day,day1为空,仍然需要补上值为0,因此不对两张表实施联合查询。在语句rs(1)=rs1(0)时候,
此时rs(1)="    " 只是留空,便于打印。
此时不能赋值吗,还是由于变量类型不同?请帮忙解答一下,谢谢,可能表述不是很简洁,见谅,谢谢!

解决方案 »

  1.   

    测试了代码没问题
    像这样的新建个窗体全copy过来就行了
    有些问题说不清楚
      

  2.   

    sorry,copy wrong!sql="select day,day1,day2  from info_v where num='rs(0)' and  ……"
    应该改成这样
    sql="select day,day1,day2  from info_v where num='" & rs(0) "' and  ……"
      

  3.   

    sql="select day,day1,day2  from info_v where num='" & rs(0) & "' and  ……"
      

  4.   

    sql="select day,day1,day2  from info_v where num='" + rs(0) + "' and  ……"
    对,这个地方是写错了,但是在把rs1(0)赋值给rs(1)的时候为什么不行呢?
      

  5.   

    recordset打开的时候,后面还有cursortype和locktype参数,你都设置对了?如果rs不能更新,你把机器砸了也写不进去。