家长/子女关系/访问2010 [英] Parent/Child Relationship / Access 2010

查看:50
本文介绍了家长/子女关系/访问2010的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始创建一个数据库(截至目前只有一个表)。

数据库用于存储有关技术要求的信息。在一个行业中。

每行对应一个要求。它包含有关该特定要求的描述,验证方法等信息。


有一个字段,RID和(要求ID)。

还有两个字段(父母,儿童),用于表示这些技术要求之间的父/子关系。


我使用查找向导作为数据类型这两个字段(父母,孩子)。

它使用户能够查看所有行(要求)的RID列表,并为父母(或孩子)选择多个值。

换句话说,有一个要求列表,您可以选择哪些要求是其他人的父母。


现在这就是我想做的事情:

我想启用一些自动互惠。

当用户选择Requirement 1作为Requirement 2的父项时。我希望Access在children中自动显示RID 2。需求的领域1.


换句话说,我不希望用户在指定父母/子女关系时做两次。


我希望我已经清楚/如果没有我可以进一步解释。

,如果需要,我会创建多个表。

I have started creating a database (There is only one table as of now).
The database is meant to store information about "technical requirements" in an industry.
Each row corresponds to one requirement. It contains information such as description, verification method, etc regarding that specific requirement.

There is a field, "RID" (Requirement ID).
There are also two fields ("Parents", "Children") that are intended to indicate the parent/child relationship between these technical requirements.

I used the lookup wizard as "datatype" of these two fields (Parents, Children).
It gives the user the ability to see the list of RIDs of all rows (requirements) and choose multiple values for parents (or children).
In other words, there is a list of requirements and you can choose which requirements are parents of others.

Now here''s what I would like to do:
I want to enable some automatic reciprocity.
When the user chooses Requirement 1 as parent of Requirement 2. I want Access to automatically show RID 2 in the "children" field of Requirement 1.

In other words I don''t want the user to do everything twice when designating parent/child relationship.

I hope I have been clear/ if not I can explain further.
also, I will create more than one table if need be.

推荐答案

您可以使用更新查询。 WHERE子句将是父ID的值,您可以将Children字段更新为子RID的值。


不完全确定这对您有用,因为我不知道你的数据,但你可能不需要拥有Children字段。我想你拥有Children字段的原因是你可以有一个子窗体列出你父母的子节点。您可以创建包含所有字段的表格查询,而不是将Child的RID与父项一起存储。然后,在创建子窗体时,将Master / Child字段设置为Master:RID,Child:Parent。这将导致它搜索在其Parent字段中具有ParentID的所有记录。这有意义吗?
You could use an update query. The WHERE clause would be the value of the parent ID and you would update Children field to the value of the child''s RID.

Not totally sure this will work for you since I don''t know your data, but you might not need to have the Children field. I would imagine that the reason you have the Children field is so that you could have a subform listing the children of your Parent. Instead of storing the Child''s RID with the parent, you can create a query of your table including all fields. Then when you create your subform, set the Master/Child fields to be Master: RID, Child: Parent. This will cause it to search for all the records that have your ParentID in its Parent field. Does that make sense?


Seth

我正在尝试你建议的第一件事,一个更新查询。

什么是用来代码的代码。


让我们说表'的名字是'table'。


这是更新查询将在每次用户进行更改时自动运行吗?

至于为什么我创建了一个字段名称Children,因为我在一个单独的页面上显示每一行(要求),而我希望用户看到该要求的父母和子女。
Seth
I am trying the first thing you suggested, an update query.
what would be the code you use to do it.

let''s say the table''s name is "table".

Is this update query going to be automatically run everytime a user make changes?

As for why I created a field name Children, because I show every row (requirement) on a separate page, and I want the user to see both parents and children of that requirement.


让我们假设存储RID字段的控件名是txtRID,存储父字段的控件名是txtParent。然后,您将以下代码放在Parent控件的AfterUpdate事件中。

Lets assume that the control name that stores the RID field is txtRID and the control name that stores the parent field is txtParent. You would then put the following code in the Parent control''s AfterUpdate event.

展开 | 选择 < span class =codeDivider> | Wrap | 行号


这篇关于家长/子女关系/访问2010的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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