选择“下次检定日期”查询时排除“运维状态”列内容是"检定"的行。。。这个代码不知怎么写了,请老师帮助。
Dim Val As WinForm.ComboBox = e.Form.Controls("boBoox")
Dim tex As WinForm.TextBox = e.Form.Controls("TexFind")
Dim str As String = tex.text
Dim stm As String = Val.Value
Dim ksrq As WinForm.DateTimePicker = e.Form.Controls("StartDate")
Dim jsrq As WinForm.DateTimePicker = e.Form.Controls("EndDate")
Dim Filter As String = "1=1"
Select Case stm
Case "器具名称"
Tables("杭康设备总表").filter = "器具名称 like'*" & str & "*'"
ksrq.Value = Nothing
jsrq.Value = Nothing
Case "原编号"
Tables("杭康设备总表").filter = "原编号 like'*" & str & "*'"
ksrq.Value = Nothing
jsrq.Value = Nothing
Case "型号规格"
Tables("杭康设备总表").filter = "型号规格 like'*" & str & "*'"
ksrq.Value = Nothing
jsrq.Value = Nothing
Case "出厂编号"
Tables("杭康设备总表").filter = "出厂编号 like'*" & str & "*'"
ksrq.Value = Nothing
jsrq.Value = Nothing
Case "证书编号"
Tables("杭康设备总表").filter = "证书编号 like'*" & str & "*'"
ksrq.Value = Nothing
jsrq.Value = Nothing
Case "下次检定日期"
Tables("杭康设备总表").filter = "[运维状态] NOT = '检定'"
If ksrq.Value IsNot Nothing Then
Filter = Filter & " and 下次检定日期 >= #" & ksrq.Value.Date & "#"
End If
If jsrq.Value IsNot Nothing Then
Filter = Filter & " and 下次检定日期 < #" & jsrq.Value.Date.adddays(1) & "#"
End If
Tables("杭康设备总表").Filter = filter
tex.Value = Nothing
Case "期间核查日期"
If ksrq.Value IsNot Nothing Then
Filter = Filter & " and 期间核查日期 >= #" & ksrq.Value.Date & "#"
End If
If jsrq.Value IsNot Nothing Then
Filter = Filter & " and 期间核查日期 < #" & jsrq.Value.Date.adddays(1) & "#"
End If
Tables("杭康设备总表").Filter = filter
tex.Value = Nothing
End Select