Dim Filter As String
Dim trn As RibbonMenu.TextBox = RibbonTabs("功能区1").Groups("功能组5").Items("trucknum")
Dim sfa As RibbonMenu.TextBox = RibbonTabs("功能区1").Groups("功能组5").Items("sfaddress")
Dim sfn As RibbonMenu.TextBox = RibbonTabs("功能区1").Groups("功能组5").Items("sfnum")
Dim ssn As RibbonMenu.TextBox = RibbonTabs("功能区1").Groups("功能组5").Items("ssnum")
Dim std As RibbonMenu.DatePicker = RibbonTabs("功能区1").Groups("功能组5").Items("startdate")
Dim edd As RibbonMenu.DatePicker = RibbonTabs("功能区1").Groups("功能组5").Items("enddate")
Dim ry As RibbonMenu.CheckBox = RibbonTabs("功能区1").Groups("功能组5").Items("rdoyifu")
Dim rw As RibbonMenu.CheckBox = RibbonTabs("功能区1").Groups("功能组5").Items("rdoweifu")
'Dim sfnn As RibbonMenu.NumericBox = RibbonTabs("功能区1").Groups("功能组5").Items("sfnn")
'Dim ssnn As RibbonMenu.NumericBox = RibbonTabs("功能区1").Groups("功能组5").Items("ssnn")
With trn
If .text <> Nothing Then
Filter = "车号= '" & .text & "'"
End If
End With
With sfa
If .text <> Nothing Then
If Filter > "" Then
Filter = Filter & "And "
End If
Filter = Filter & "收发地点 like '%" & .text & "%'"
End If
End With
With sfn
If .text <> Nothing Then
If Filter >"" Then
Filter = Filter & "And "
End If
Filter = Filter & "实发数= " & .text
End If
End With
With ssn
If .text <> Nothing Then
If Filter >"" Then
Filter = Filter & "And "
End If
Filter = Filter & "实收数= " & .text
End If
End With
With std
If .Value <> Nothing Then
If Filter >"" Then
Filter = Filter & "And "
End If
Filter = Filter & "日期 >= #" & .Value & "#"
End If
End With
With edd
If .Value <> Nothing Then
If Filter >"" Then
Filter = Filter & "And "
End If
Filter = Filter & "日期 <= #" & .Value & "#"
End If
End With
If ry.Checked = True ' 如果付款状态选择了"已付"
If Filter >"" Then
Filter = Filter & "And "
End If
Filter = Filter & "运费结算实付日期 is not null"
End If
If rw.Checked = True ' 如果付款状态选择了"未付"
If Filter >"" Then
Filter = Filter & "And "
End If
Filter = Filter & "运费结算实付日期 Is Null"
End If
If Filter > "" Then
Tables("运费查询").Filter = Filter
End If