根据ComboBox的选择应用过滤器

编程入门 行业动态 更新时间:2024-10-19 03:33:11
本文介绍了根据ComboBox的选择应用过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

好的我正在使用Access 2007,有几个表格和几个表格。 主要数据保存到表格:Load_Records 有一个表格更新该表命名为:添加新加载到数据库 还有另一个用于打印自定义报告的表单:生成报告 生成报告表单自动创建和通过绑定到Load_Records表的数据填充记录集。在这个表单的页脚中有三个组合框命名为:CompanySelect,DriverSelect和TruckSelect 组合框的值自动填充在名为的表/列中:公司!公司,司机!司机和卡车!卡车 我想要做的是自动过滤所有记录的Load_Records OnChange这些组合框中的任何一个或全部。 我玩过DoCmd.ApplyFilter,但没有成功让它正常工作。

解决方案

这是一般的想法,假设所有文本字段:

展开 | 选择 | 换行 | 行号

好的,谢谢你的提示,但它不适合我.....这里是一个表格的屏幕截图。 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的选择应用过滤器

本文发布于:2023-11-22 20:27:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1618906.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:过滤器   ComboBox

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!