如何使用父窗体中的字段作为查找来填充子窗体中的字段? [英] How to fill a field in a subform using a field in the parent form as a lookup?

查看:49
本文介绍了如何使用父窗体中的字段作为查找来填充子窗体中的字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表单/子表单排列,其中父表单有一个Patient_Type,我想根据现有的查找表将其转换为Hospital_Category。 Patient_Type和医院类别之间的关系是多对一的;即,有几种患者类型会崩溃成一个医院类别。


父母表格是FBR220V直接表格(这是一个标签 - 提供给我们的分隔文件,我们导入到现有的表结构中)。 Patient_Type字段的控件是PAT_TYP


子窗体的控件是Coders''Comments" 。 Hospital_Category字段的控件是" HospitalCategory"

查找表,患者类型/类别 ,有三个字段:索引(自动编号),患者类型医院类别


在子表单中,first field是用户的首字母,这是他们输入的第一件事,我想我希望医院类别只有在他们提供首字母后才能填写。所以我想我想要做的只是在 AfterUpdate 属性中,但我不知道使用父's " PAT_TYPE" 的语法从查找表中提取医院类别的密钥。


感谢您的帮助!

I have a form/subform arrangement where the parent form has a Patient_Type that I want to translate into a Hospital_Category based on an existing lookup table. The relationship between Patient_Type and Hospital Category is many-to-one; i.e., there are several patient types that collapse into a single hospital category.

The parent form is "FBR220V direct form" (this is a tab-delimited file supplied to us that we import into an existing table structure). The Patient_Type field''s control is "PAT_TYP".

The subform''s control is "Coders'' Comments". The Hospital_Category field''s control is "HospitalCategory".

The lookup table, "Patient Types / Categories", has three fields: "Index" (an autonumber), "Patient Type", and "Hospital Category".

On the subform, the "first" field is the user''s initials, which would be the first thing they enter, and I''m thinking that I would like the Hospital Category to be filled only after they supply their initials. So I think I want whatever I do to be in the AfterUpdate property, but I don''t know the syntax for using the parent''s "PAT_TYPE" as a key to extract "Hospital Category" from the lookup table.

Thanks for your help!

推荐答案

假设患者类型为字符串:


在afterUpdate事件中:
Assuming Patient type is string:

In the afterUpdate event:
展开 | 选择 | Wrap | 行号


另一种可能不太明显的解决方案是使用预先填充的多列,ComboBox控件,用户可以从可用的患者类型中进行选择,但保存的是包含医院类别的列。这样可以避免在数据中重复查找并使用预先填充的列表(因此只能访问一次表),以确保只选择有效的选项。
Another, possibly less obvious, solution is to use a prepopulated, multi-column, ComboBox control where the user can select from the available Patient Types, but what is saved is the column containing the Hospital Category. This avoids repeated lookups in the data and uses a prepopulated list (so table only accessed once) that ensures only valid options are selected.


我喜欢这两个建议,并且可能会尝试每个转,只是为了看看会发生什么。

NeoPa,有没有办法可以让你以编程方式做出你的建议?导入的数据提供 Patient_Type ,我认为如果子表单只填写 HospitalCategory 字段(基于 Patient_Type 一旦用户填写她的姓名首字母,就用父表格。


(我是否解释过用户只将数据输入父表格?父母的所有字段?形式被锁定。如果这使得任何事情更清楚,或有任何区别。)
I like both these suggestions, and will probably try each in turn, just to see what happens.

NeoPa, is there a way that I could make what you suggest happen programmatically? The imported data provides the Patient_Type, and I think it would be nice and smooth if the subform just filled in the HospitalCategory field (based on the Patient_Type in the parent form) as soon as the user fills in her initials.

(Did I explain that the user is entering data only into the parent form? All the fields on the parent form are locked. If this makes anything clearer, or makes any difference.)


这篇关于如何使用父窗体中的字段作为查找来填充子窗体中的字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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