Form/subform for inputting data

  • Thread starter Thread starter Primoz Bradac
  • Start date Start date
P

Primoz Bradac

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
 
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.
 
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.
Thanks, Jeff, for your answer.

Yes, I agree orphan is not the right word - widow could be a better
choice :-)

As for <Delete> button, it does not satisfy me quite, because the user
would have to remember to click it whenever he would like to quit
entering the order - something which could not be expected from an
average user.

By the way I still do not see what approach the designers take in this
case.

Regards,
Primoz
 
Back
Top