在访问中创建一个表单,该表单将字段添加到多个表中 [英] Creating a form in access that adds fields to more than table
问题描述
因此,我有3个表,并且我希望能够创建将在表1中添加新行的表单,然后使用该数据在表3中添加具有表1和2中的值的行.对表格结构进行了简要概述.请让我知道是否可以澄清任何事情.
So I have 3 tables, and I'd like to be able to create form that will add a new row to table 1, and then use that data to add rows on table 3 with values from table 1 and 2. I've included a brief overview of the table structure. Please let me know if I can clarify anything.
Table 1 - Things
Table 2 - TypesofThings
Table 3 - ThingType
表中的记录示例:
Table1:
ID - 1 Name: "This"
ID - 2 Name: "That"
表2 :(此表是事物的预定义类型,上限为15)
Table2: (This table is predefined types of things capped at 15)
`ID - 1 TypeName: Yellow`
`ID - 2 TypeName: Red`
`ID - 3 TypeName: Green`
表3:这是一个与表1到表2的字段匹配的事务"表
Table3: This is a "transaction" table that matches the field from table 1 to table 2
`ID: 1 Table1_ID:1 Table2_ID:1`
`ID: 2 Table1_ID:1 Table2_ID:2`
`ID: 3 Table1_ID:1 Table2_ID:3`
`ID: 4 Table1_ID:2 Table2_ID:2`
我想做的事的示例形式:
Example Form of what I'd like to be able to do:
Thing Name: "whatever"
[x] yellow
[] red
[x] green
此提交会将名称添加到表1的任何行,然后使用表2的值和表3的2行的值,例如:
This submission would add a row to table 1 with the name whatever, and then using the values from table 2 and 2 rows to table 3 like:
id:1 table1_id:1 table2_id:1
id:2 table1_id:1 table2_id:3
我已经创建了将添加新行的表单,但是我不知道如何做其余的事情.如果你们能为我指出正确的方向,将不胜感激!
I have created the form that will add new rows, but I can't figure out how to do the rest. If you guys could point me in the right direction it would be greatly appreciated!
推荐答案
看起来像多对多关系.常规数据输入结构:
Looks like many-to-many relationship. Conventional data entry structure:
-
绑定到表3的单个表单,并带有组合框以从表1和表2中选择项目
single form bound to table 3 with comboboxes to select items from tables 1 and 2
绑定到表2的主表单和绑定到表3的子表单(带有组合框,以从表1中选择项目)
main form bound to table 2 and subform bound to table 3 with combobox to select items from table 1
绑定到表1的主表单和绑定到表3的子表单,并通过组合框从表2中选择项目
main form bound to table 1 and subform bound to table 3 with combobox to select items from table 2
如果您希望能够在数据输入过程中向作为即时"组合框来源的表中添加项目,请查看组合框NotInList事件. MS NotInList事件
If you want to be able to add items to table that is source for combobox 'on-the-fly' during data entry, look into the combobox NotInList event. MS NotInList event
这篇关于在访问中创建一个表单,该表单将字段添加到多个表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!