如何通过当前记录过滤表字段的列表框 [英] How to filter a table field's listbox by the current record

查看:96
本文介绍了如何通过当前记录过滤表字段的列表框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置表的字段,以便该行的数据过滤列表框?

How do I set up a table's field so that the listbox is filtered by that row's data?

我有一个主表( TblMain ),其中包含2个重要字段:客户部门.当前,划分"字段设置为一个简单的列表框,可从另一个表( TblDiv )中提取.

I have a master table (TblMain) with 2 important fields: Client and Division. Currently, the Division field is set up as a simple Listbox that pulls from another table (TblDiv).

但是,这些部门是针对每个客户的,几乎没有重叠.我目前的基本设置没有这个区别,因此可以为任何客户选择任何部门.

However, the Divisions are specific to each client with little overlap. My current basic setup doesn't make that distinction, so any division can be chosen for any client.

如何设置部门,使列表框特定于该行?

How do I set up Division so that the listbox is specific to that row?

我尝试在行源(即Select TblDiv.Div from TblMain Inner Join TblDiv on TblMain.Client=TblDiv.Client)中进行内部联接,但这似乎不起作用,可能是因为我没有引用活动行的Client值.

I've tried doing an inner join within the row source (i.e. Select TblDiv.Div from TblMain Inner Join TblDiv on TblMain.Client=TblDiv.Client) but that doesn't seem to work, probably because I'm not referencing the Client value of the active row.

(我应该补充一点,我不是在谈论表单或报表.只是Table对象)

(I should add I'm not talking about Forms or Reports. Just the Table object)

推荐答案

您是否要向表中添加查找字段?这几乎从来不是一个好主意.您是否要过滤连续表单上的组合框?您无法明智地执行此操作-任何更改都会影响每一行的外观,这会使用户感到困惑.有解决方法.例如,您可以显示参考的文本框和更改参考"组合.由于绑定的文本框不会更新,因此可以避免混淆用户.您可以使用条件格式设置更改组合的各种属性,以使其更加美观.另外,您可以使用两个子表单或弹出表单来编辑数据.

Are you trying to add a look-up field to a table? This is almost never a good idea. Are you trying to filter a combobox on a continuous form? You cannot sensibly do this - any change will affect the appearance of every row, which is confusing to the user. There are work-arounds. For example, you can show a textbox for the Reference and a "Change reference" combo. This will avoid confusing users because the bound textbox will not update. You can set various properties of the change combo with conditional formatting to make it all prettier. Alternatively, you can use two subforms or a pop-up form to edit data.

这篇关于如何通过当前记录过滤表字段的列表框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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