Foxtable(狐表)用户栏目专家坐堂 → [求助]查询窗口?


  共有3266人关注过本帖树形打印复制链接

主题:[求助]查询窗口?

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


加好友 发短信
等级:一尾狐 帖子:407 积分:3194 威望:0 精华:0 注册:2011/2/28 11:57:00
[求助]查询窗口?  发帖心情 Post By: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编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
方丈
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:811 积分:10928 威望:0 精华:1 注册:2008/9/2 18:58:00
  发帖心情 Post By:2015/10/3 12:12:00 [只看该作者]

Dim c1 As String = e.Form.controls("ComboBox6").text

 回到顶部
帅哥哟,离线,有人找我吗?
cqlpjks
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:407 积分:3194 威望:0 精华:0 注册:2011/2/28 11:57:00
  发帖心情 Post By: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编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
方丈
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:811 积分:10928 威望:0 精华:1 注册:2008/9/2 18:58:00
  发帖心情 Post By:2015/10/3 23:53:00 [只看该作者]

我这里不会出错啊,您是查询哪些内容?

 回到顶部
帅哥哟,离线,有人找我吗?
xuebai
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:133 积分:2273 威望:0 精华:0 注册:2008/9/1 8:41:00
  发帖心情 Post By:2015/10/4 0:29:00 [只看该作者]

测试正常

 回到顶部
帅哥哟,离线,有人找我吗?
cqlpjks
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:407 积分:3194 威望:0 精华:0 注册:2011/2/28 11:57:00
  发帖心情 Post By:2015/10/4 10:01:00 [只看该作者]

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


 回到顶部