求大神指点: 用户表有三列为用户名|公司|公司1|公司2,分析表有公司列:在分析表的公司列中分别填入用户表中的公司|公司1公司2的名称,在加载分析表时此用户有查看所有公司的权限代码如下:
Dim Filter As String
Filter = "公司 = '" & Tables("用户表").Current("公司") & "'and 公司 = '" & Tables("用户表").Current("公司1") & "'and 公司 = '" & Tables("用户表").Current("公司2") & "'"
DataTables("分析表").LoadFilter = Filter
DataTables("分析表").Load()
打开窗口加载时只能加载名称为公司的行,不能加载名称为公司1和公司2的行。
同样的方式,查询时代码:
Dim khmc As WinForm.ComboBox = e.Form.Controls("客户名称")
DataTables("分析表").LoadFilter = "客户名称 like '%" & khmc.text & "%'and 公司 = '" & Tables("用户表").Current("公司") & "'and 公司 = '" & Tables("用户表").Current("公司1") & "'and 公司 = '" & Tables("用户表").Current("公司2") & "'"
DataTables("分析表").Load()
查询时只能查询出名称为公司的行,不能查询出名称为公司1和公司2的行。
请大神指点一下,谢谢