你能在查找中放一个过滤表达式吗? [英] Can you put a filter expression on a lookup?

查看:61
本文介绍了你能在查找中放一个过滤表达式吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一对多的关系:制造商到模型



制造商表有[ManufacturerID],[ManufacturerName]



产品表有[ProductID],[ProductName],[ManufacturerID]


订单表有[OrderID],[ManufacturerID],[ProductID ]


在订单表单中,我正在尝试根据已选择的[ManufacturerID]查找过滤[ModelID]查找。我正在寻找一些关于什么用作过滤器表达式的帮助,以及在哪里为ModelID查找添加它。所有指导都非常感谢。

解决方案

在ManufacturerID组合框(cboManufacturer)的After Update事件中,您可以更改ModelID组合框(cboModel)的行来源。这假定ManufacturerID是Model表中的外键。它还假设ManufacurerID是一种数字类型。

展开 | 选择 | Wrap | 行号


本教程(在表单上过滤示例。)将给出主题的完整说明。


首先,感谢大家的帮助。


有一件奇怪的事我无法理解,但我想我差不多了。当我在 cboManufacturer 查找中进行选择时,它会正确过滤 ModelID 查找。唯一的是,所有的选择都是不可见的。


我可以告诉我的原因是,如果我选择的模型很少,那么 ModelID 查找的选择很少,看不见。相反,如果我选择一个拥有大量模型的制造商, ModelID 查找有一个巨大的,不可见的列表。


如果我检查表格中的那个控件绑定,表单IS正确更新记录,我可以看到值,他们不是不可见的。


太奇怪了!


这是我的代码:

展开 | 选择 | Wrap | 行号

One to Many relationship: Manufactuerer to Model



Manufactuerer table has [ManufacturerID], [ManufacturerName]


Products Table has [ProductID], [ProductName], [ManufacturerID]


Order table has [OrderID], [ManufacturerID], [ProductID]


In an order form, I''m trying to filter the [ModelID] lookup based on the already selected [ManufacturerID] lookup. I''m looking for some help on what to use as a filter expression, and where to add it for the ModelID lookup. All guidance appreciated guys thanks.

解决方案

In the After Update event of the ManufacturerID combobox (cboManufacturer) you can change the row source of the ModelID combobox (cboModel). This assumes that ManufacturerID is a foreign key in the Model table. It also assumes ManufacurerID is a number type.

Expand|Select|Wrap|Line Numbers


This Tutorial (Example Filtering on a Form.) will give a full explanation of the subject.


First off, thanks a ton for the help.

There''s one weird thing I can''t clear up, but I think I''m almost there. When I make a selection in the cboManufacturer lookup it does filter the ModelID lookup correctly. The only thing is, all the selections are INVISIBLE.

The reason I can tell this, is that if I select a manufacturer that has very few models, the ModelID lookup has very few, invisible, selections. Conversly if I select a manufacturer that has a ton of models, the ModelID lookup has a huge, invisible, list.

If I check the table that the controls are bound to, the form IS updating the records correctly, there I CAN see the values and they''re NOT invisible.

So weird!

Here''s my code:

Expand|Select|Wrap|Line Numbers


这篇关于你能在查找中放一个过滤表达式吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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