将过滤器应用于具有子表单的表单 [英] applying a filter to a form that has a subform

查看:58
本文介绍了将过滤器应用于具有子表单的表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 - 我有一个名为Vendor的表单(与同名表绑定)。每个vendor_id都可以属于多个类别。所以有一个名为Vendor_Category的表,它只包含vendor_id和category。


在供应商表单上,有一个名为Vendor_Category的子表单。当用户处于供应商表单并且位于特定vendor_id的记录中时,他们使用Vendor_Category子表单中的combo_box来选择可能属于相关供应商的Vendor_Categories。


工作正常,但现在我想按Vendor_Category过滤,只看到属于某个类别的供应商记录。所以我添加了一个未绑定的vendor_category组合框,它只包含所有不同类别的列表。当用户从列表中选择一个时,我已经在AfterUpdate中添加了我想用来设置过滤器的代码。


不幸的是,我不知道怎么写过滤。我知道我设置过滤器然后打开过滤器。但语法对我来说是一个谜。


任何帮助都将不胜感激。


谢谢,

Bill

Hi - I have a form called Vendor (tied to table with same name). Each vendor_id can belong to more than one ''category''. So there''s a table called Vendor_Category which contains just vendor_id and category.

On the Vendor form, there''s a subform called Vendor_Category. When a user is in the Vendor form and is in a record for a particular vendor_id, they use a combo_box in the Vendor_Category subform to select Vendor_Categories that can belong to the Vendor in question.

That works fine, but now I want to filter by Vendor_Category and just see vendor records the belong to a certain category. So I added an unbound vendor_category combobox which just contains a list of all the different categories. When a user selects one from the list, I''ve added code in the AfterUpdate that I want to use to set the filter.

Unfortunately, I have no clue how to write the filter. I know I set the filter and then turn the filter on. But the syntax is a mystery to me.

Any help would be greatly appreciated.

Thanks,
Bill

推荐答案

Form.Filter Property 就像Where条件一样,如下所示:
The Form.Filter Property is just like a Where Condition, so something like:
< span class =codeLinkonclick =Blur(this,this.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | 行号


谢谢,


给我带来麻烦的部分是你的例子中的[类别]部分。当事件运行时,它会打开一个询问参数值的对话框。


当我输入代码时,我将字段放入[category]中空间,它不会识别它并将其改为大写。我想也许是因为它是在一个子窗体上,但即使我从主窗体中放入一个字段,它仍然没有变成大写字母。


注意以下信息:

1.主表格名称为供应商。它的记录来源是供应商。表。 " VENDOR_ID"是主键。

2.主窗体上的Sub_form名称称为Vendor_Category_sub。子表单的源对象是表单sub_Vendor_Category。 Link Child和Link Master字段都是Vendor_ID。

3.在表格sub_Vendor_Category上,记录源是Vendor_Category。仅包含Vendor_ID的表格和Vendor_Category领域。 供应商类别字段是我想要过滤的。

4.供应商上的组合框。我用来触发过滤器的形式称为Vendor_Category_Filter。


只是想要彻底。我已经检查过[vendor_category]名称是否在某个地方重复了,但我找不到另一个实例。


再次感谢您的帮助。
Hi and thanks,

The part that''s giving me trouble is the [Category] section in your example. When the event runs, it opens up a dialog box asking for the parameter value.

When I''m putting in the code and I put the field in as [category] with lower space, it doesn''t recognize it and change it to uppercase. I thought maybe it was because it was on a subform, but even when I put in a field from the main form, it still doesn''t change to upper case.

Note the following information:
1. Main form name is "Vendor". It''s Record Source is the "Vendor" table. "Vendor_ID" is the primary key.
2. Sub_form name on the main form is called "Vendor_Category_sub". The Source Object for the subform is the form "sub_Vendor_Category". The Link Child and Link Master fields are both "Vendor_ID".
3. On the form "sub_Vendor_Category", the Record Source is the "Vendor_Category" table which contains only "Vendor_ID" and "Vendor_Category" fields. The "Vendor Category" field is what I''m trying to filter on.
4. The combo box on the "Vendor" form that I''m using to trigger the filter is called "Vendor_Category_Filter".

Just wanted to be thorough. I''ve checked to see if the [vendor_category] name was duplicated somewhere, but I can''t find another instance.

Thanks again for any future help.


代码中的[Category]应替换为主窗体的基础记录集中字段的名称。
[Category] in the code should be replaced with the name of the field in the main form''s underlying recordset.


这篇关于将过滤器应用于具有子表单的表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆