以连续形式显示多对多关系 [英] Display many to many relationship in continuous form
问题描述
我不知道如何以连续形式显示对同一记录具有很多值的列
I can't figure out how to display a column that has many value for the same record in a continuous form
我有3张桌子
SalesCall
SalesCallId | etc..
Mill
MillId | name...
SalesCallMills <------ Junction table
Id | SalesCallId | MillID
多对多关系的基本设计.
the basic design for a many to many relationship.
当它是一种简单的形式时,我习惯于使用SQL查询列出并更改当前ID的控制源.
When it's a simple form, I'm used to do a list and change the control source for the current ID with a SQL query.
以连续形式显示此内容的常见做法是什么?
What's the common practice to display this in a continuous form?
这是以前只有1铣削的情况下的形式.
This was the form before when only 1 mill was possible.
我以为我可以吸引工厂,但这很难读,而且很长.
I thought I could concat the mills, but it will be hard to read and it will be way to long.
所以我想到了一个列表,但我认为不可能更改每条记录的控制源.
So I thought about a list but I don't think it's possible to change the control source for each record.
此外,值得一提的是,这是只读的.它不是用于添加或编辑.输入数据的表格已经完成.而且我认为每条记录只允许一个工厂,因为这会使用户感到困惑.
Also, good to mention that this is read-only. It's not for adding or editing. The form to enter data is already made. And I think that one mill per record is not an option cause it would really confuse the user.
在我的数据库设计中显示多值列的正确方法是什么?
What's the proper way to display a multi value column with my database design?
推荐答案
这是具有相关子表单的表单.
This is a form with correlated subforms.
通过链接子字段和主字段对这两种形式进行同步:
The two forms are synchronized via the link child and master fields:
Link Master Fields: Forms!Form7![SalesCall Subform].Form.SaleID
Link Child Fields: SalesCallId
子窗体#1的当前事件中还有一些代码
And a little code in the Current Event of subform #1
Private Sub Form_Current()
Me.Parent.[SalesCallMills subform].Form.Requery
End Sub
在子窗体#1中选择一行会在子窗体#2中显示相关的详细信息行.
Selecting a line in subform #1 displays the relevant detail lines in subform #2.
在工厂概述中添加有关工厂名称之类的适当信息应该不难.
It should not be difficult to add suitable information on such things as mill name to the general outline.
这篇关于以连续形式显示多对多关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!