Dim Filter As String = "1=1"
With e.Form.Controls("pmname")
If .Value IsNot Nothing Then
Filter &= " and 产品名称 = '" & .Value & "'"
End If
End With
With e.Form.Controls("ckname")
If .Value IsNot Nothing Then
Filter &= " and 仓库 = '" & .Value & "'"
End If
End With
With e.Form.Controls("khname")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "客户名称 = '" & .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("rdo1").Checked = True
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "单据状态='已审核'"
End If
If e.Form.Controls("rdo2").Checked = True
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "单据状态<>'已审核' or 单据状态 is null"
End If
Tables("销售单明细").Filter = Filter
If Tables("销售单明细").rows.count=0
Tables("销售单明细").GrandTotal = False
Else
Tables("销售单明细").Cols("匹数").GrandTotal = True
Tables("销售单明细").Cols("米数").GrandTotal = True
Tables("销售单明细").GrandTotal = True '显示合计模式
End If