MS-Access, form that adds info to a one to many re

2019-09-15 17:11发布

问题:

I have a access table with Orders and a sub-table with itemId's. It has one to many relationship.

I want to create a form that adds itemId's to a selected order(already existing).

This is how i expect it to look like:

Order:        [            ]
ItemId:       [            ]
Measurement1: [            ]
Measurement2: [            ]

        [Save-button]

Can anyone help me with this?

回答1:

Subforms are the politically correct way to go IF you want users to have access to the order screen. If users do not need access to the order details directly, only to items, then you could put a combo-box for

 Order: [              [V]]

which has its control source as a query for your order ID in the orders table. Link that to your Orders field in the Item table and it will store the order as a subform would, without letting the user see details of the order.

However, if you want multiple items shown for a selected order, use subforms (having a subform which is multiple-item)



回答2:

Look into subforms. The Orders table will be for the main form and the items will be on the subform. Access does a good job of handling the OrderID key in the Items records.