在筛选按钮的事件,Click事件放入代码:
Dim biao As String = e.Form.Controls("cmbProduct").Value
Dim lie As String = e.Form.Controls("cmbCustomer").Value
Dim Filter As String
With e.Form.Controls("cmbEmployee")
If .Value IsNot Nothing Then
Filter = "lie = '" & .Value & "'"
End If
End With
With e.Form.Controls("StartDate")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "登记时间 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("EndDate")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "登记时间 <= #" & .Value & "#"
End If
End With
If e.Form.Controls("rdoYifu").Checked = True ' 如果付款状态选择了"已付"
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "已付款 = True"
End If
If e.Form.Controls("rdoWeifu").Checked = True ' 如果付款状态选择了"未付"
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "已付款 = False Or 已付款 Is Null"
End If
If Filter > "" Then
Tables(biao).Filter = Filter
End If
Dim f As New Filler
f.SourceTable = DataTables(biao) '指定数据来源
f.SourceCols = "来电单位,来电编号,电文标题及文号,等级,密级,页数,收报编号" '指定数据来源列
f.DataTable = DataTables("借阅登记") '指定数据接收表
f.DataCols = "来电单位,来电编号,电文标题及文号,等级,密级,页数,收报编号" '指定数据接收列
f.filter = Tables(biao).filter '指定数据来源
f.Fill() '填充数据
运行后提示:未找到列 [lie]。
敬请修改代码,谢谢!!!