用代码生成的表,SQLQuery类型,弄出来查询无效果,还是哪些地方写的有问题,高手帮忙改改,谢谢
Dim Filter As String
With e.Form.Controls("jieshou")
If .Value IsNot Nothing Then
Filter = "jieshoudanwei = '" & .Value & "'"
End If
End With
With e.Form.Controls("laiyuan")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "laiyuanjing = '" & .Value & "'"
End If
End With
With e.Form.Controls("danju")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "danjuzhuangtai = '" & .Value & "'"
End If
End With
With e.Form.Controls("weixiu")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "weixiuzhuangtai = '" & .Value & "'"
End If
End With
With e.Form.Controls("chanpin")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "chanpin_xinghao = '" & .Value & "'"
End If
End With
With e.Form.Controls("jihao")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "jihao = '" & .Value & "'"
End If
End With
If e.Form.Controls("sxriqi").Checked = True
With e.Form.Controls("kai")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "sx_riqi >= #" & .Value & "#"
End If
End With
With e.Form.Controls("jieshu")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "sx_riqi <= #" & .Value & "#"
End If
End With
If e.Form.Controls("jieriqi").Checked = True
With e.Form.Controls("kai")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "jieshouriqi >= #" & .Value & "#"
End If
End With
With e.Form.Controls("jieshu")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "jieshouriqi <= #" & .Value & "#"
End If
End With
If e.Form.Controls("pairiqi").Checked = True
With e.Form.Controls("kai")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "pai_riqi >= #" & .Value & "#"
End If
End With
With e.Form.Controls("jieshu")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "pai_riqi <= #" & .Value & "#"
End If
End With
If e.Form.Controls("huiriqi").Checked = True
With e.Form.Controls("kai")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "weixiuriqi >= #" & .Value & "#"
End If
End With
With e.Form.Controls("jieshu")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "weixiuriqi <= #" & .Value & "#"
End If
End With
If Filter > "" Then
Tables("信息追踪_table1").Filter = Filter
End If
End If
End If
End If
End If