If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Form/subform for inputting data
Hi everyone!
I'm interested in the solution of the following "problem": Let's have two tables in an orders database: tblOrders and tblOrdersDetails. To enter data into these two tables the user has to be presented a form with a subform. He first has to fill in the information about the order (order number, CustomerNo, Date etc.) into the form and as many entries for order details (Part, quantity, unit of measurement etc.) as needed into the subform. As the data integrity is enforced (the two tables are related through the order number) the record in tblOrders has to be inserted before any order items are added. How is this achieved? What is the general or most common approach to it? What is usually used with the subform: the datasheet or form view (the former offers somewhat better view about what has been entered already) Or is it better to first show the user the form (without any subform) for entering general data about the order (which adds a record in the tblOrders table) and then show him the form for entering order details. What if he changes his mind and stops before entering any order details. How to get rid of the orphan record in the tblOrders table in this case? I'd appreciate any hints or references. TIA, Primoz |
#2
|
|||
|
|||
Form/subform for inputting data
The way Access works, if the user "leaves" the main form (say, by clicking
into the subform), the data in the main (Order) form is saved. If the user then starts to enter subform data (OrderDetail), that subform (and related table) have a row started, "inheriting" the main form's ID. This is only true if the subform is correctly related to the main form via the Parent/Child field properties. As to how a user might delete a main form (Order) record, you could add a Delete button. A note ... if the main form is bound to your "parent" table, a record in that table wouldn't, technically, be called an "orphan". An "orphan" record would be a row in the child table (OrderDetail) that had no parent table row to point to. -- Good luck Jeff Boyce Access MVP |
#3
|
|||
|
|||
Form/subform for inputting data
|
Thread Tools | |
Display Modes | |
|
|