txt(0) = RsAdo("人数")
txt(1) = RsAdo("出勤")
txt(2) = RsAdo("人均出勤")
txt(3) = RsAdo("产量")
txt(4) = RsAdo("工效")
txt(5) = RsAdo("各项考核")
其中记录集中的“人数”和“工效”的记录是空的,怎么用让txt(0)和txt(4)赋值为空呢?
用if 语句该怎么写?

解决方案 »

  1.   

    txt(0)   =   RsAdo("人数") & ""
    txt(1)   =   RsAdo("出勤") & ""
    txt(2)   =   RsAdo("人均出勤") & ""
    txt(3)   =   RsAdo("产量") & ""
    txt(4)   =   RsAdo("工效") & ""
    txt(5)   =   RsAdo("各项考核") & ""
      

  2.   

    1楼的办法估计能行,并且感觉能挺好。
    要是我那就用笨的方法,呵呵,做判断,如果字段的value是空就把一个空穿给文本框数组
    if len(trim(RsAdo("人数").value))=0 then
       txt(0).text=""
    endif
    那个同理,方法比较笨
      

  3.   

    如果 RsAdo= nothing
    或者 RsAdo.eof and RsAdo.bof 怎么样办?碰到上面两种情况,肯定是出错.
      

  4.   

    txt(1) =iif (isnull(RsAdo("出勤"))=false,RsAdo("出勤"),“”)
      

  5.   

    txt(0)= IIf(IsNull(RsAdo("人数")), "", RsAdo("人数")) 
      

  6.   

    txt(1)   =iif   (isnull(RsAdo("出勤"))=false,RsAdo("出勤"),“”)