Dim Filter As String
With e.Form.Controls("领取单位1")
If .Value IsNot Nothing Then
Filter = "领取单位 = '" & .Value & "'"
End If
End With
With e.Form.Controls("制品名称1")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "制品名称 like '*" & .Value & "*'"
End If
End With
With e.Form.Controls("起始日期1")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "出库日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("结束日期1")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "出库日期 <= #" & .Value & "#"
End If
End With
With e.Form.Controls("结束日期1")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "结账日期 <= #" & .Value & "#" ' and 结账日期 is null)"
End If
End With
If Filter > "" Then
Tables("财务管理_外欠明细").Filter = Filter
End If
Tables("财务管理_外欠明细").Sort = "编号,出库日期"
因为有对账的需要,所以需要查询 截止到 <结束时间>的外欠明细,但数据是动态的,可能需要查询时在<结束时间>后又有结账的,但在<结束时间>后结账的在查询时间段内仍属于未结账的,需要筛选出在<结束时间>前未结账的行
呵呵,不知道表达清楚没有