使用子表单填充表 [英] Using Subforms to Populate a Table

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

问题描述

所以我有一个名为tblArea和tblSection的表。  字段和关系显示如下。 
一个部分可能只分配给一个区域,但每个区域可能有多个部分。 
这些部分是我们执行工作的方式。  这些领域确实不影响"我们如何做",而是影响我们在报告中"如何呈现"我们的工作。 
因此,我们可能会向数据库添加一个部分,并将审核程序添加到该部分,并且当时不知道我们要将该部分指定给哪个区域。 
但是,我们不希望这样做,因为我们可以稍后决定区域分配。 
我的第一个想法是使用表单/子表单方法填充sections表。 
您可以选择表单顶部的区域,然后分配这些部分,这些部分又会填充部分表。

So I have a tables called tblArea and tblSection.  The fields and relationships are displayed below.  A section may be assigned to only one area, but each area may have multiple sections.  The sections are how we perform our work.  The areas really don’t affect "how we do anything" but rather they affect "how we present" our work in the reports.  Therefore, we may add a section to the database and add audit procedures to the section and not know at that time what area we want to assign the section to.  However, we wouldn’t want that to hold things up since we can decide on the area assignment later on.  My first thought was to populate the sections table with a form/subform method.  You would choose the area at the top of the form and then assign the sections, which would in turn populate the sections table.

然后我意识到了什么如果我想删除某个区域的某个部分? 
我设置的方式我必须从部分表中删除该部分。 
这样做不会很好,因为它可能会给分配给该部分的程序带来问题。 
所以我想如果我单独使用一个单独的表单填充了一个部分表。 
然后,我有一个连接表(我的图表中没有显示),我可以将这些部分和区域连接在一起。 
这样,如果我需要添加一个部分来开始工作,我可以这样做,而不必立即担心部分分配。

But then I realized what if I wanted to remove a section from an area?  The way I had it set up I would have to delete the section from the sections table.  Doing that would not be good because it could present problems with the procedures that had been assigned to the section.  So I thought what if I had a sections table all alone that was populated with the a separate form.  Then, I had a join table (not displayed in my diagram) where I could join the sections and areas together.  This way, if I needed to add a section to begin work, I could do so without having to worry with the section assignment right away.

如果这样有道理,我想知道单独的连接表是否是解决我问题的最佳途径? 
如果我走这条路,我是否必须有两个表格,一个是添加部分,一个是将它们映射到这些区域?

If this makes sense, I wanted to know if the separate join table was the best route for my problem?  If I go that route, will I have to have two forms, one to add sections and one to map them to the areas?

感谢您的帮助。

推荐答案

不确定我是否遵循,但您的图表似乎是正确的,所以我认为您不需要另一张桌子。由于您不知道新部分属于哪个区域,因此您不需要在区域和部分之间设置表单/子表单。相反,您只需在
的部分表单上添加一个组合框。

Not sure I follow but your diagram seems correct, so I don't think you need another table. Since you don't know what area a new section belongs, you don't need a form/subform setup between area and section. Instead, you could just simply add a combobox on the section form.

我可能建议在部分和过程之间设置表单/子表单。

I would probably suggest a form/subform setup between section and procedures.

希望它有所帮助......

Hope it helps...


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

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