以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  有点甜等高手老师们,这两个控件怎么关联!  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=115426)

--  作者:tygzjsl
--  发布时间:2018/3/7 10:24:00
--  有点甜等高手老师们,这两个控件怎么关联!

图片点击可在新窗口打开查看此主题相关图片如下:5.png
图片点击可在新窗口打开查看


图片点击可在新窗口打开查看此主题相关图片如下:6.png
图片点击可在新窗口打开查看
有点甜老师,我按照你的代码,输入分数,能按这个范围出现,可是再选择以下条件时,就不是这个范围了,输入分数的控件怎么和下面的控件关联啊,以下是我的代码,还要加什么!
Dim v1 As String = e.form.controls("textbox1").text
Dim v2 As String = e.form.controls("textbox2").text
Tables("高考信息查询表").Filter = "zdffs >= " & v1 & " and zgffs <= " & v2

Dim Filter As String
With e.Form.Controls("院校地区:")
    If .Value IsNot Nothing Then
        Filter = "yxdq = \'" & .Value & "\'" 
    End If
End With

With e.Form.Controls("院校地址:")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "yxdz = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("院校名称:")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "yxmc = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("专业名称:")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "zymc = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("年    度:")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "nd = \'" & .Value & "\'"
 End If
End With
With e.Form.Controls("科    类:")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "kl = \'" & .Value & "\'"
 End If
End With

If Filter > "" Then
    Tables("高考信息查询表").Filter = Filter
End If

--  作者:minxizai
--  发布时间:2018/3/7 10:33:00
--  
Dim v1 As String = e.form.controls("textbox1").text
Dim v2 As String = e.form.controls("textbox2").text
Tables("高考信息查询表").Filter = "zdffs >= " & v1 & " and zgffs <= " & v2

Dim Filter As String
Filter = "zdffs >= " & v1 & " and zgffs <= " & v2   \'试试看
With e.Form.Controls("院校地区:")
    If .Value IsNot Nothing Then
        Filter = Filter & “and" & "yxdq = \'" & .Value & "\'" 
    End If
End With
[此贴子已经被作者于2018/3/7 10:42:26编辑过]

--  作者:tygzjsl
--  发布时间:2018/3/7 10:43:00
--  
有点甜老师,我加上了这段,还是那样!
--  作者:有点甜
--  发布时间:2018/3/7 11:08:00
--  

Dim Filter As String = "1=1"
Dim v1 As String = e.form.controls("textbox1").text
If v1 > "" Then
    filter &= " And zdffs >= " & v1
End If
Dim v2 As String = e.form.controls("textbox2").text
If v2 > "" Then
    filter &= " And zdffs <= " & v2
end if

With e.Form.Controls("院校地区:")
    If .Value IsNot Nothing Then
        Filter &= " and yxdq = \'" & .Value & "\'"
    End If
End With


With e.Form.Controls("院校地址:")
    If .Value IsNot Nothing Then
        Filter = Filter & " and yxdz = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("院校名称:")
    If .Value IsNot Nothing Then
        Filter = Filter & " and yxmc = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("专业名称:")
    If .Value IsNot Nothing Then
        Filter = Filter & " and zymc = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("年    度:")
    If .Value IsNot Nothing Then
       
        Filter = Filter & " and nd = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("科    类:")
    If .Value IsNot Nothing Then
        Filter = Filter & " and kl = \'" & .Value & "\'"
    End If
End With


msgbox(filter)
Tables("高考信息查询表").Filter = Filter

[此贴子已经被作者于2018/3/7 11:08:57编辑过]

--  作者:tygzjsl
--  发布时间:2018/3/7 14:00:00
--  
老师,我换上这个代码后,直接查不了了,

图片点击可在新窗口打开查看此主题相关图片如下:8.png
图片点击可在新窗口打开查看


--  作者:有点甜
--  发布时间:2018/3/7 14:45:00
--  

If v2 > "" Then
    filter &= " And zdffs <= " & v2
end if

 

改成

 

If v2 > "" Then
    filter &= " And zgffs <= " & v2
end if


--  作者:tygzjsl
--  发布时间:2018/3/7 15:08:00
--  
非常感谢,可以查询了,但是每当选择一个条件时,会出现这样的会话框

图片点击可在新窗口打开查看此主题相关图片如下:13.png
图片点击可在新窗口打开查看

图片点击可在新窗口打开查看此主题相关图片如下:11.png
图片点击可在新窗口打开查看

图片点击可在新窗口打开查看此主题相关图片如下:12.png
图片点击可在新窗口打开查看


--  作者:有点甜
--  发布时间:2018/3/7 15:16:00
--  
删除代码 msgbox(filter)
--  作者:tygzjsl
--  发布时间:2018/3/7 15:27:00
--  
解决问题啦,非常感谢!
[此贴子已经被作者于2018/3/7 15:28:35编辑过]