以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]查询窗口?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=75284)

--  作者:cqlpjks
--  发布时间:2015/10/3 11:31:00
--  [求助]查询窗口?

例子:

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:高中期末成绩统计程序.rar

查询代码有误,如何修改?请指教,谢谢!

Dim tjs() As String = {"ComboBox1","ComboBox2","ComboBox3","ComboBox4","ComboBox5","ComboBox7"}
Dim sps() As String = {"\'","\'","\'","\'","\'"," "}
Dim c1 As String = e.Form.controls("ComboBox6")
Dim bjf() As String = {" = "," = "," = "," = "," = "," "& c1 &" "}
Dim fds() As String = {"单位","部别","年级","班","姓名","总分名次"}
Dim Filter As String
For i As Integer = 0 To tjs.length - 1
    If e.Form.Controls(tjs(i)).Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & fds(i) & bjf(i) & sps(i) & e.Form.controls(tjs(i)).value & sps(i)
    End If
Next
MessageBox.Show("你查询的是:" & Filter)
Tables("成绩库").Filter = Filter

 


图片点击可在新窗口打开查看此主题相关图片如下:qq图片20151003111859.png
图片点击可在新窗口打开查看
[此贴子已经被作者于2015/10/3 11:31:31编辑过]

--  作者:方丈
--  发布时间:2015/10/3 12:12:00
--  
Dim c1 As String = e.Form.controls("ComboBox6").text
--  作者:cqlpjks
--  发布时间:2015/10/3 21:47:00
--  

还是出错,怎么回事?请指教,谢谢!
图片点击可在新窗口打开查看此主题相关图片如下:123.png
图片点击可在新窗口打开查看"ComboBox7"=10时

 

Dim tjs() As String = {"ComboBox1","ComboBox2","ComboBox3","ComboBox4","ComboBox5","ComboBox7"}
Dim sps() As String = {"\'","\'","\'","\'","\'"," "}
Dim mc As String = e.Form.Controls("ComboBox6").text
Dim bjf() As String = {" = "," = "," = "," = "," = ",""& mc &""}
Dim fds() As String = {"单位","部别","年级","班","姓名","总分名次"}
Dim Filter As String
For i As Integer = 0 To tjs.length - 1
    If e.Form.Controls(tjs(i)).Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & fds(i) & bjf(i) & sps(i) & e.Form.controls(tjs(i)).value & sps(i)
    End If
Next
MessageBox.Show("你查询的是:" & Filter)
Tables("成绩库").Filter = Filter

[此贴子已经被作者于2015/10/3 22:48:54编辑过]

--  作者:方丈
--  发布时间:2015/10/3 23:53:00
--  
我这里不会出错啊,您是查询哪些内容?
--  作者:xuebai
--  发布时间:2015/10/4 0:29:00
--  
测试正常
--  作者:cqlpjks
--  发布时间:2015/10/4 10:01:00
--  

谢谢!搞定了。由于我程序中的运算符错了,应为“<    >    <=    >=   <>   =”。