accsee里的空记录,取出来,放在MSFlexGrid里。调试时,老是有这个错误,实时错误‘94’无效使用 NULL。各位帮帮忙了。

解决方案 »

  1.   

    msflexgrid是不支持NULL的,你可以这样
    msflexgrid=rs!id & ""  '就是在后面加个空符就不会有NULL了
      

  2.   

    msflexgrid.text=rs!id & ""
      

  3.   

    If rst.EOF = False Then
           With Me.MSFlexGrid1
           .Rows = 1
           While Not rst.EOF
             
            .Rows = .Rows + 1
            .TextMatrix(.Rows - 1, 0) = rst(0)
            .TextMatrix(.Rows - 1, 1) = rst(1)
            .TextMatrix(.Rows - 1, 2) = rst(2)
            .TextMatrix(.Rows - 1, 3) = rst(3)
       rs.MoveNext
        Wend
         End With
         Loop
      rs.CloseEnd Sub
    我语句是这样写的,哪里写错了!
      

  4.   

    if not rs.eof then
      set msflexgrid.datasource=rs
    end if
      

  5.   

    If rst.EOF = False Then
           With Me.MSFlexGrid1
           .Rows = 1
           While Not rst.EOF
             
            .Rows = .Rows + 1
            .TextMatrix(.Rows - 1, 0) = iif(isnull(rst(0))," ",rst(0))
            .TextMatrix(.Rows - 1, 1) = iif(isnull(rst(1))," ",rst(1))
            .TextMatrix(.Rows - 1, 2) = iif(isnull(rst(2))," ",rst(2))
            .TextMatrix(.Rows - 1, 3) =iif(isnull(rst(3))," ",rst(3))
       rs.MoveNext
        Wend
         End With
         Loop
      rs.CloseEnd Sub
      

  6.   

    在前面+
    on error resume next
      

  7.   

    If rst.EOF = False Then
           With Me.MSFlexGrid1
           .Rows = 1
           While Not rst.EOF
             
            .Rows = .Rows + 1
            .TextMatrix(.Rows - 1, 0) = iif(isnull(rst(0))," ",rst(0))
            .TextMatrix(.Rows - 1, 1) = iif(isnull(rst(1))," ",rst(1))
            .TextMatrix(.Rows - 1, 2) = iif(isnull(rst(2))," ",rst(2))
            .TextMatrix(.Rows - 1, 3) =iif(isnull(rst(3))," ",rst(3))
       rs.MoveNext
        Wend
         End With
         Loop
      rs.CloseEnd Sub
      

  8.   

    .TextMatrix(.Rows - 1, 0) = rst(0) & ""
    .TextMatrix(.Rows - 1, 1) = rst(1) & ""
    .TextMatrix(.Rows - 1, 2) = rst(2) & ""
    .TextMatrix(.Rows - 1, 3) = rst(3) & ""
      

  9.   

    set mshflexgrid.recordset = 你的recordset记录集
    一个一个格写太慢了
    你的那个错误与表格应该没关系,是因为你引用了一个null值产生的
      

  10.   

    .TextMatrix(.Rows - 1, 0) = iif(isnull(rst(0))," ",rst(0))
    .TextMatrix(.Rows - 1, 1) = iif(isnull(rst(1))," ",rst(1))
    .TextMatrix(.Rows - 1, 2) = iif(isnull(rst(2))," ",rst(2))
    .TextMatrix(.Rows - 1, 3) =iif(isnull(rst(3))," ",rst(3))就这个最好了
      

  11.   

    .TextMatrix(.Rows - 1, 0) = iif(isnull(rst(0))," ",rst(0))
    .TextMatrix(.Rows - 1, 1) = iif(isnull(rst(1))," ",rst(1))
    .TextMatrix(.Rows - 1, 2) = iif(isnull(rst(2))," ",rst(2))
    .TextMatrix(.Rows - 1, 3) =iif(isnull(rst(3))," ",rst(3))
      

  12.   

    .TextMatrix(.Rows - 1, 0) = "" & rst(0))
    .TextMatrix(.Rows - 1, 1) = "" & rst(1))
    .TextMatrix(.Rows - 1, 2) = "" & rst(2))
    .TextMatrix(.Rows - 1, 3) = "" & rst(3))
    有文件介绍用IIF慢
      

  13.   

    iif 是慢,iif真假条件满足的后果都判断
      

  14.   

    一楼就挺简单的,直接在后面加个[ & ""]就可以了
      

  15.   

    If rst.EOF = False Then
           With Me.MSFlexGrid1
           .Rows = 1
           While Not rst.EOF
             
            .Rows = .Rows + 1
            .TextMatrix(.Rows - 1, 0) = rst(0) & “” '后面加个空字符串就好了
            .TextMatrix(.Rows - 1, 1) = rst(1) & “”
            .TextMatrix(.Rows - 1, 2) = rst(2) & “”
            .TextMatrix(.Rows - 1, 3) = rst(3) & “”
       rs.MoveNext
        Wend
         End With
         Loop
      rs.CloseEnd Sub
      

  16.   

    with msflexgrid
       .col=1
       .text=Trim(Rs("Name") & "")
    end with
      

  17.   

    With msf1
       .Row = 1
        Do While Not mrc.EOF
         .Rows = .Rows + 1
         For i = 1 To mrc.Fields.Count
          .TextMatrix(.Row, i) = mrc.Fields(i - 1) & ""   '后面加个空字符串
         Next i
          .Row = .Row + 1
         mrc.MoveNext
        Loop
     End With
      

  18.   

    这个问题是由于出现Null值引起的!可以把null值换成""值,就不会有问题了!楼上各位大哥大姐的解决方法都写出来了,偶就不多说了呵呵
      

  19.   

    text1=rs.recordset.fields("lasdkjflas")&""
      

  20.   

    If IsNull(rs.Fields(rs.Fields(j - 1).Name).Value) = True Then
                MSFlexGrid1.TextMatrix(i, j) = "<NULL>"
            Else
                MSFlexGrid1.TextMatrix(i, j) = rs.Fields(rs.Fields(j - 1).Name).Value
     End If
      

  21.   

    If IsNull(rs(i - 1)) Then
                        strSearchResult(iCount, i) = ""
                    Else
                        strSearchResult(iCount, i) = rs(i - 1)
                    End If
      

  22.   

    就是加一个判断ISNull()就行了哈!
                    If IsNull(rs(i - 1)) Then
                        strSearchResult(iCount, i) = ""
                    Else
                        strSearchResult(iCount, i) = rs(i - 1)
                    End If