Foxtable(狐表)用户栏目专家坐堂 → [求助]我这个查询条件,怎么没有效果?帮忙看看怎么回事,谢谢


  共有3807人关注过本帖平板打印复制链接

主题:[求助]我这个查询条件,怎么没有效果?帮忙看看怎么回事,谢谢

帅哥哟,离线,有人找我吗?
aduydgd
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:681 积分:5332 威望:0 精华:0 注册:2011/12/26 20:43:00
[求助]我这个查询条件,怎么没有效果?帮忙看看怎么回事,谢谢  发帖心情 Post By:2014/2/27 14:18:00 [只看该作者]

用代码生成的表,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


 回到顶部
总数 18 1 2 下一页