Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Unload event "you canceled the previous operation" error

Geek News

Unload event "you canceled the previous operation" error
Sophia 12/26/2008 5:16:01 AM
Hi: I am trying to advise the user that a subform is empty before they close
the main form. When "yes" is chosen, to not close the form, the form does
not close, but, I am getting a message " you canceled the previous
operation". On the Unload event, I have the following:

Dim intResponse As Variant

If SubfrmAssessment_Details_Admission.Form.RecordsetClone.RecordCount = 0 Then
intResponse = MsgBox("Enter an Admission Assessment", vbYesNo, "Admission
assessment is not done")

If intResponse = vbYes Then
DoCmd.CancelEvent
End If
End If

End Sub

Sophia
Re: Unload event "you canceled the previous operation" error
"Stuart McCall" <smccall[ at ]myunrealbox.com> 12/26/2008 7:27:50 AM
"Sophia" <Sophia[ at ]discussions.microsoft.com> wrote in message
news:15347A58-F8BF-4983-AD8A-BFA4B55AD246[ at ]microsoft.com...
[Quoted Text]
> Hi: I am trying to advise the user that a subform is empty before they
> close
> the main form. When "yes" is chosen, to not close the form, the form does
> not close, but, I am getting a message " you canceled the previous
> operation". On the Unload event, I have the following:
>
> Dim intResponse As Variant
>
> If SubfrmAssessment_Details_Admission.Form.RecordsetClone.RecordCount = 0
> Then
> intResponse = MsgBox("Enter an Admission Assessment", vbYesNo, "Admission
> assessment is not done")
>
> If intResponse = vbYes Then
> DoCmd.CancelEvent
> End If
> End If
>
> End Sub
>
> Sophia

Replace:

DoCmd.CancelEvent

with

Cancel = True

Notice the boolean Cancel parameter in the Unload event procedure's
definition. At runtime, this is passed to the procedure by reference, which
means that any change to its value will be 'returned' to Access, which will
then prevent the form from closing.


Re: Unload event "you canceled the previous operation" error
Sophia 12/29/2008 11:11:01 PM
Hi Stuart: I have this post also on Dec 26th, since there was a problem with
the website and the message did not show up, so I posted it again.

I did try what you suggested, but then I receive the pop up " no current
record". Any other suggestions?

"Stuart McCall" wrote:

[Quoted Text]
> "Sophia" <Sophia[ at ]discussions.microsoft.com> wrote in message
> news:15347A58-F8BF-4983-AD8A-BFA4B55AD246[ at ]microsoft.com...
> > Hi: I am trying to advise the user that a subform is empty before they
> > close
> > the main form. When "yes" is chosen, to not close the form, the form does
> > not close, but, I am getting a message " you canceled the previous
> > operation". On the Unload event, I have the following:
> >
> > Dim intResponse As Variant
> >
> > If SubfrmAssessment_Details_Admission.Form.RecordsetClone.RecordCount = 0
> > Then
> > intResponse = MsgBox("Enter an Admission Assessment", vbYesNo, "Admission
> > assessment is not done")
> >
> > If intResponse = vbYes Then
> > DoCmd.CancelEvent
> > End If
> > End If
> >
> > End Sub
> >
> > Sophia
>
> Replace:
>
> DoCmd.CancelEvent
>
> with
>
> Cancel = True
>
> Notice the boolean Cancel parameter in the Unload event procedure's
> definition. At runtime, this is passed to the procedure by reference, which
> means that any change to its value will be 'returned' to Access, which will
> then prevent the form from closing.
>
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net