以文本方式查看主题
- Foxtable(狐表) (http://foxtable.com/bbs/index.asp)
-- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2)
---- [求助] (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=102467)
|
-- 作者:独行侠
-- 发布时间:2017/6/20 13:31:00
-- [求助]
一步步实现了好多,现在最后搜索的代码卡住了,我的搜素用的是两个表
此主题相关图片如下:`r1rfis78{m8bk21su}mzaf.png
我现在 选择 人员的话 上面显示的就是人的名字跟编号(人员表的东西),选择的是物资的话,上面显示的就是 物资名称和物资的编号
我想实现: 点击开始搜索, 就会在另一张表上显示出来这个人或者物资的所有信息(也就是所在表的那一行信息) 输入姓名或者编号 都可以搜索的到
这样的代码该怎么写? (涉及人员表和物资表)(我也尝试着改了一下帮助里面的代码,但是一预览,人员表跟资源表里面的内容就全没了。)
|
-- 作者:有点色
-- 发布时间:2017/6/20 14:10:00
--
分开写不就可以了?如果有问题,做个具体例子发上来测试。
If e.Form.Controls("rdoYifu").Checked = True Dim t = Tables("人员") Dim Filter As String = "" With e.Form.Controls("cmbProduct") If .Value IsNot Nothing Then Filter = "产品 = \'" & .Value & "\'" End If End With With e.Form.Controls("cmbCustomer") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "客户 = \'" & .Value & "\'" End If End With t.Filter = Filter ElseIf e.Form.Controls("rdoWeifu").Checked = True Dim t = Tables("物资") Dim Filter As String = "" With e.Form.Controls("cmbProduct") If .Value IsNot Nothing Then Filter = "产品 = \'" & .Value & "\'" End If End With With e.Form.Controls("cmbCustomer") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "客户 = \'" & .Value & "\'" End If End With t.Filter = Filter End If
|
-- 作者:独行侠
-- 发布时间:2017/6/20 16:25:00
-- 回复:(有点色)分开写不就可以了?如果有问题,做个...
If e.Form.Controls("人员").Checked = True Dim t = Tables("人员") Dim Filter As String = "" With e.Form.Controls("ComboBox1") If .Value IsNot Nothing Then Filter = "name= \'" & .Value & "\'" End If End With With e.Form.Controls("ComboBox2") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "bh= \'" & .Value & "\'" End If End With t.Filter = Filter ElseIf e.Form.Controls("物资").Checked = True Dim t = Tables("物资") Dim Filter As String = "" With e.Form.Controls("ComboBox1") If .Value IsNot Nothing Then Filter = "wzmc= \'" & .Value & "\'" End If
这代码可以用,人员,物资可以实现分别搜索了,就是有个新问题
此主题相关图片如下:ayls3f22_ofabhag670_8p.jpg
这个搜索结果是显示在 我的人员表 和 物资表的 搜索一次,其他数据就都没了,我也不知道怎么恢复。我想让搜索结果在一张新表显示出来。我那两张表还有其他数据关联,不能没有。
怎么能让搜索结果在一张新表上显示?
|
-- 作者:有点色
-- 发布时间:2017/6/20 16:44:00
--
做一个窗口【窗口2】,放入一个table控件【Table1】,然后改代码。
If e.Form.Controls("人员").Checked = True Forms("窗口2").Show Dim t = Forms("窗口2").Controls("Table1").Table t.DataSource = DataTables("人员") Dim Filter As String = "" With e.Form.Controls("ComboBox1") If .Value IsNot Nothing Then Filter = "name= \'" & .Value & "\'" End If End With With e.Form.Controls("ComboBox2") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "bh= \'" & .Value & "\'" End If End With t.Filter = Filter
[此贴子已经被作者于2017/6/21 9:07:51编辑过]
|
-- 作者:独行侠
-- 发布时间:2017/6/20 17:57:00
-- 回复:(有点色)做一个窗口【窗口2】,放入一个table...
请问 窗口中的 table怎么增加 列? 属性里面只有行设置,帮助里面说 表不能用事件 可以用代码吗?
|
-- 作者:有点色
-- 发布时间:2017/6/20 18:03:00
--
你为什么要给窗口的table增加列?
只能用代码增加 http://www.foxtable.com/webhelp/scr/1428.htm
[此贴子已经被作者于2017/6/20 18:03:39编辑过]
|
-- 作者:独行侠
-- 发布时间:2017/6/20 19:00:00
-- 回复:(有点色) 你为什么要给窗口的table增加列...
窗口里面的table开始是10列,我的资源表有13列,不够用的的。帮助里面增加的是临时列,临时列重新打开项目不就没了吗
|
-- 作者:有点蓝
-- 发布时间:2017/6/20 20:16:00
--
绑定表就行了,设置为副本。到时就能显示了,有多少列就能显示多少列,不需要其它操作
|
-- 作者:独行侠
-- 发布时间:2017/6/21 8:00:00
--
此主题相关图片如下:0%b4pddj98lf5el45{w%`79.jpg
我把代码加上后,出现了这样的问题
我的搜索的click事件的代码
If e.Form.Controls("人员").Checked = True Forms("搜索结果").Show Dim t = Forms("搜索结果").Controls("Table1").Table t.DataSouce = DataTables("人员") Dim Filter As String = "" With e.Form.Controls("ComboBox1") If .Value IsNot Nothing Then Filter = "name= \'" & .Value & "\'" End If End With With e.Form.Controls("ComboBox2") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "bh= \'" & .Value & "\'" End If End With t.Filter = Filter ElseIf e.Form.Controls("物资").Checked = True Forms("搜索结果").Show Dim t = Forms("搜索结果").Controls("Table1").Table t.DataSouce = DataTables("物资") Dim Filter As String = "" With e.Form.Controls("ComboBox1") If .Value IsNot Nothing Then Filter = "wzmc= \'" & .Value & "\'" End If End With With e.Form.Controls("ComboBox2") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "bh= \'" & .Value & "\'" End If End With t.Filter = Filter End If
[此贴子已经被作者于2017/6/21 8:03:45编辑过]
|
-- 作者:有点色
-- 发布时间:2017/6/21 9:09:00
--
If e.Form.Controls("人员").Checked = True Forms("搜索结果").Show Dim t = Forms("搜索结果").Controls("Table1").Table t.DataSource = DataTables("人员") Dim Filter As String = "" With e.Form.Controls("ComboBox1") If .Value IsNot Nothing Then Filter = "name= \'" & .Value & "\'" End If End With With e.Form.Controls("ComboBox2") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "bh= \'" & .Value & "\'" End If End With t.Filter = Filter ElseIf e.Form.Controls("物资").Checked = True Forms("搜索结果").Show Dim t = Forms("搜索结果").Controls("Table1").Table t.DataSource = DataTables("物资") Dim Filter As String = "" With e.Form.Controls("ComboBox1") If .Value IsNot Nothing Then Filter = "wzmc= \'" & .Value & "\'" End If End With With e.Form.Controls("ComboBox2") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "bh= \'" & .Value & "\'" End If End With t.Filter = Filter End If
|