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. > > >
|