|
Private Sub Command21_Click()
Dim strWhere As String '定义条件字符串
strWhere = "" '设定初始值-空字符串
If Not IsNull(Me.日期) Then
'有输入
strWhere = strWhere & "([日期] like '*" & Me.日期 & "*') AND "
End If
If Not IsNull(Me.未返金额) Then
'有输入
strWhere = strWhere & "([未返金额] like '*" & Me.未返金额 & "*') AND "
End If
If Not IsNull(Me.发货单位) Then
'有输入
strWhere = strWhere & "([发货单位] like '*" & Me.发货单位 & "*') AND "
End If
If Not IsNull(Me.收货人电话) Then
'有输入
strWhere = strWhere & "([收货人电话] like '*" & Me.收货人电话 & "*') AND "
End If
If Not IsNull(Me.货物名称) Then
'有输入
strWhere = strWhere & "([货物名称] like '*" & Me.货物名称 & "*') AND "
End If
If Not IsNull(Me.终点站) Then
'有输入
strWhere = strWhere & "([终点站] like '*" & Me.终点站 & "*') AND "
End If
If Not IsNull(Me.收货单位) Then
'有输入
strWhere = strWhere & "([收货单位] like '*" & Me.收货单位 & "*') AND "
End If
If Not IsNull(Me.付款方式) Then
'有输入
strWhere = strWhere & "([付款方式] like '*" & Me.付款方式 & "*') AND "
End If
'如果输入了条件,那么strWhere的最后肯定有" AND ",这是我们不需要的,
'要用LEFT函数截掉这5个字符。
If Len(strWhere) > 0 Then
'有输入条件
strWhere = Left(strWhere, Len(strWhere) - 5)
End If
查询4-1日的单子时子窗体查询结果怎么出现4-1日,4-11日,4-12日所有4月十几日的单子
'让子窗体应用窗体查询
Me.[发货信息查询].Form.Filter = strWhere
Me.[发货信息查询].Form.FilterOn = True
End Sub |
|