SubForms

Mark Jones

New member
Local time
Today, 05:56
Joined
Mar 10, 2000
Messages
7
I have a standard form with a sub-form.
The problem I am observing is that
every time the user changes focus from
main form to sub-form, or vica-versa, the
form attempts to save the data to the table.
I know this to be true because I have code attached to the onupdate event. What I would
like to have happen is the form and sub-form data stay static on the form, and in memory,
until either I close the form or press a
"SAVE" button. At that time I can verify
critical fields and control the save process.

I'm sure it's in the way I have set up my
form and sub-form, but I can't seam to find the right combination.

Thanks in advance.

Mark Jones
 
The sub form and the main form contain data that is related. The main form shows data from the one side of a relationship and the sub form shows data from the many side. You should have relationships set up (in the relationship window) that enforce referential ingegrity between the tables. In order to save data in the many table, the related record must already have been saved in the one table. That's why when you move from the main form to the sub form, the data in the main form must be saved. Put all your edits for the main form in that form's BeforeUpdate event. If there are any errors you can cancel the update.

As to the subform, each record on it is related to the record on the main form but they are not related to each other. Therefore, as you move from record to record on the sub form, each of them must be saved.

Get some books and do some reading on application and database design. They should make this clearer.
 

Users who are viewing this thread

Back
Top Bottom