Dim dt As DataTable = Tables(e.form.Name & "_Table1").DataTable
Dim Filter As String
Dim T As String = e.form.Controls("TextBox1").Value '定义控件的值
For Each dc As DataCol In dt.DataCols '遍历表的所有列
If dc.IsDate OrElse dc.IsBoolean OrElse dc.IsNumeric Then '如果是时间列,逻辑列,数值列
Continue For '排除
End If
If Filter = "" Then
Filter = Filter & "[" & dc.Name & "] Like '%" & T & "%'" '根据控件值迷糊筛选
Else
Filter = Filter & " or [" & dc.Name & "] Like '%" & T & "%'" '根据控件值迷糊筛选
End If
Next
With e.Form.Controls("报表名称")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = "报表名称 = '" & .Value & "'"
End If
End With
With e.Form.Controls("ComboBox1")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "年 = '" & .Value & "'"
End If
End With
With e.Form.Controls("ComboBox2")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "月 = '" & .Value & "'"
End If
End With
MessageBox.Show(Filter)
第一段的模糊筛选和第二段的报表名称 怎么连不起来了 我晕死了