HELP! with saving records on forms with subforms

  • Thread starter Thread starter Tony Williams
  • Start date Start date
T

Tony Williams

I have an input form that has three tab controls. On two of the tab controls
are sub forms based on two other tables. I've learned thru the help of Van
T Dinh from this newsgroup that as the focus moves from the main form to the
subform the record is automatically saved. I want to display a message when
the user has keyed in the data for a new record giving them the opportunity
to say whether or not they want to save the new record or not as they click
on a command button which closes the form if they do by clicking on Yes but
leaves the form open to edit if they click on No. I've got the code sorted
for the message box but if I put it behind the Close button it doesn't work
because the record has already been saved (because by then the focus has
moved from the main form) and if I put it in the BeforeUpdate property of
the form the message pops up as the focus moves from the main form to the
sub form. The user may not always use the subform.
Can anyone help here with a possible solution?
TIA
Tony Williams
 
Form_BeforeUpdate is the way to go. You say that this fires if the user
clicks on the subform "but the user might not click on the subform".
Correct! - but so what? It >also< fires if the user does >anything else<
that requires the record to be saved: for example, closing the form, or
moving to another main record.

HTH,
TC
 
Thanks TC I did think of the BeforeUpdate but the message I want to appear
asks the user if they want to save the record if it is a new record. If as
part of the data input they have to complete controls in the sub form then
they wont get the message because the record has been autmatically saved and
is therefore not "new" I want the message to appear when the user has
finished t
keying in the new record and that could be after keying in fields in the
subform
Hope I've explained that?
Any suggestions?
Tony
 
Back
Top