In the subform's BeforeUpdate procedure, use a message box to ask the user
if they want to save the changes. If they respond no, then Cancel the update
and Undo the form to get rid of the changes. To prevent the same prompt when
the Save button is clicked, you could have the Save button set the value of
a form level variable and check for this value in the form's BeforeUpdate
event. Skip the prompt if the value has been set, but remember to clear the
value to reset it for the next record.
--
Wayne Morgan
MS Access MVP
"Pete" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I currently have a form that has two subforms. One subform contains a
> list of individuals and the other subform contains detailed information
> associated with the individual.
>
> Here is my problem. I the detail window, I have a command to add a new
> record. If the user completes the record and clicks a save command,
> the records is properly added. However, if the user adds a record
> (docmd.gotorecord), begins to enter some data and then selects another
> individual in the invidivual subform. The new records is added.
>
> I need to stop (Cancel) this add when the subform switch occurs. I
> have entered "LostFocus and DeActivate" events in the detail subform.
> However, neither event is activated when the individual subform is
> selected.
>
> Any Ideas.
>
> Thanks
>
|