求助,无效使用NULL的出错该如何
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)If InStr(Node.Key, ",") = 0 Then Exit Sub
Dim Temp
txtSQL = ""
Temp = Split(Node.Key, ",")
For i = LBound(Temp) To UBound(Temp) - 1
If XArray(i) <> "订单日期" Then
txtSQL = txtSQL & XArray(i) & "='" & Temp(i) & "' and "
Else
txtSQL = txtSQL & XArray(i) & "=#" & Temp(i) & "# and "
End If
Next i
If XArray(i) <> "订单日期" Then
txtSQL = "SELECT 分店,订单日期,订单编号,产品名称,明细,单位数量,单位,采购数量,采购小计,备注 FROM [汇总记录$A1:J20000] WHERE " & txtSQL & XArray(i) & "='" & Temp(i) & "'"
Else
txtSQL = "SELECT 分店,订单日期,订单编号,产品名称,明细,单位数量,单位,采购数量,采购小计,备注 FROM [汇总记录$A1:J20000] WHERE " & txtSQL & XArray(i) & "=#" & Temp(i) & "#"
End If
RST.Open txtSQL, CNN, adOpenKeyset, adLockPessimistic
iCount = RST.RecordCount
LstvwInit
With ListView1
For j = UBound(Temp) + 1 To RST.Fields.Count - 1
.ColumnHeaders.Add , , RST.Fields(j).Name, 60
Next j
For i = 1 To iCount
.ListItems.Add , , RST.Fields(UBound(Temp) + 1)
For j = UBound(Temp) + 2 To RST.Fields.Count - 1
.ListItems(i).SubItems(j - UBound(Temp) - 1) = RST.Fields(j) 无效使用NULL
Next j
RST.MoveNext
Next i
End With
RST.Close
End Sub