Entering Data Into A Form

canjfn

Registered User.
Local time
Today, 00:12
Joined
Apr 24, 2001
Messages
28
I have a form with a sub-form

eg

Purchase Order with main details on (Po Number, Supplier etc)
with a sub form carrying the line items to be ordered.

Table PO
Form PO
Table POSUB
Form POSUB

When entering main order details into Form PO, why do the fields in the related table(Table PO) immediately get populated when the the focus gets transfered to the sub-form (Form POSUB). with users quiting the database illegally (not by the cancel records button) the result is unwanted records in the Table PO.

What I want to do is complete the input fields in the main and sub forms without any records being commited to the tables until the "Save Record" button is pressed.

Thankyou
 
Last edited:
The PO is the parent table in the relationship. It must contain a record before any related records can be added to a child table. That is why Access automatically saves the main form record when you move focus to a subform. You want to establish a "business rule" that says a child must be present for the parent to be valid. This has been discussed here several times if you can find the threads. Since the "business rule" violates RI, you can't implement it easily.

One solution is to have a set of temp tables where initial entry is performed. When entry is complete, the user pushes a button, you verify the completeness of the data entry and transfer the records to the permanent tables and delete them from the temp tables. This is quite a lot of work. You need to handle multi-users and abandoned entries.

A far simpler solution, if having incomplete records won't cause a serious problem, is to run a query when the db opens and present the user with a list of all abandoned entries. He may choose to complete them or delete them. For this to work, you would need to log the userID whenever you save a record so you know who added it.

Another solution is to add a "complete" flag to the PO table. The default would be false and all processes except the data entry form would exclude incomplete entries. In the AfterUpdate event of the subform, you would update the "complete" flag in the parent record to true as long as there is still at least one child record.
 
Thankyou for the explanation, will start looking into the query soloution
 

Users who are viewing this thread

Back
Top Bottom