根据ComboBox的选择应用过滤器 [英] Apply Filter based on Selection of ComboBox
问题描述
好的我正在使用Access 2007,有几个表格和几个表格。
主要数据保存到表格:Load_Records
有一个表格更新该表命名为:添加新加载到数据库
还有另一个用于打印自定义报告的表单:生成报告
生成报告表单自动创建和通过绑定到Load_Records表的数据填充记录集。在这个表单的页脚中有三个组合框命名为:CompanySelect,DriverSelect和TruckSelect
组合框的值自动填充在名为的表/列中:公司!公司,司机!司机和卡车!卡车
我想要做的是自动过滤所有记录的Load_Records OnChange这些组合框中的任何一个或全部。
我玩过DoCmd.ApplyFilter,但没有成功让它正常工作。
这是一般的想法,假设所有文本字段:
展开 | 选择 | 换行 | 行号
< blockquote>好的,谢谢你的提示,但它不适合我.....这里是一个表格的屏幕截图。 Combobox项目命名为cboCompany,cboDriver,cboTruck和cboDate。
这是我正在使用的代码:
展开 | 选择 | Wrap | 行号
假设[mmddyy]是日期/时间字段(应该重命名!):
展开 | 选择 | Wrap | 行号
Okay I am using Access 2007 with several tables and several forms.
The main data is saved to table: Load_Records
There is a Form that updates that table named: Add New Loads To Database
There is another Form used for printing custom reports named: Generate Reports
The Generate Reports form automatically creates and populates a recordset by data binding to the Load_Records table. In the footer of this form there are three combo box''s named: CompanySelect, DriverSelect and TruckSelect
The values of the combo box''s are populated automatically from tables/columns named: Company!Company, Driver!Driver and Truck!Truck
What I want to do is have ALL THE RECORDS of Load_Records filtered automatically OnChange of any or all of these combo box''s.
I have played around with DoCmd.ApplyFilter but have had no success in getting it to work correctly.解决方案Here is the general idea, assuming all Text Fields:
Expand|Select|Wrap|Line Numbers
Okay thanks for the tip but it isn''t working for me.....here is a screen shot of the form. The Combobox items are named cboCompany, cboDriver, cboTruck and cboDate.
Here is the code I am using:
Expand|Select|Wrap|Line Numbers
Assuming [mmddyy] is a Date/Time Field (should Rename!):
Expand|Select|Wrap|Line Numbers
这篇关于根据ComboBox的选择应用过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文登录 关闭
扫码关注1秒登录发送“验证码”获取 | 15天全站免登陆