On Thu, 14 Jan 2010 09:57:01 -0800, Which1 <(E-Mail Removed)>
wrote:
>The only way to close the form is by clicking the "X". In the form Unload
>event I have code to ask if you want to save the record.
Too late, unfortunately!
Access saves a mainform record the moment that you set focus to any subform on
that mainform (it must, in order to provide a parent record so that
referential integrity can be enforced). Likewise, it saves the subform record
to disk the moment you set focus back to the mainform, or to any other
subform.
If you're trying to let the users enter data into multiple tables, perhaps
multiple records into each subform, and THEN accept or reject the changes en
masse, you'll need some more complex logic, e.g. basing the form on a set of
"scratchpad" tables, and having your "accept" button or Unload event run an
Append query to copy the data from the scratchpad tables to the real tables,
and then delete the scratchpad data. VERY complex! In practice it's usually
better to train the users to only enter data when they want to enter data.
--
John W. Vinson [MVP]
|