How did my sub-form close?

G

Guest

Hi all,

I have a relatively simple report that has to call 2 forms to get my input.
If the user hits the close button on the subform - how do I know that from
the report level? I.E. how do I : ' Check to see if form is cancelled -
and quit if so

Thanks, Rusty

Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenForm "Report Date Range", , , , , acDialog, "Report Date Time
Range"
If Not IsLoaded("Report Date Range") Then
Cancel = True
End If
' Check to see if form is cancelled - and quit if so

DoCmd.OpenForm "Report Files", , , , , acDialog, "Enter Report Number Of
Files"
If Not IsLoaded("Report Files") Then
Cancel = True
End If
' Check to see if form is cancelled - and quit if so

End Sub
 
B

Brian

Rusty said:
Hi all,

I have a relatively simple report that has to call 2 forms to get my input.
If the user hits the close button on the subform - how do I know that from
the report level? I.E. how do I : ' Check to see if form is cancelled -
and quit if so

Thanks, Rusty

Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenForm "Report Date Range", , , , , acDialog, "Report Date Time
Range"
If Not IsLoaded("Report Date Range") Then
Cancel = True
End If
' Check to see if form is cancelled - and quit if so

DoCmd.OpenForm "Report Files", , , , , acDialog, "Enter Report Number Of
Files"
If Not IsLoaded("Report Files") Then
Cancel = True
End If
' Check to see if form is cancelled - and quit if so

End Sub

Your terminology is a bit awry: these are dialog boxes you are opening, not
subforms.

Anyway, the simplest way to do what you want is to code the OK buttons on
the dialog boxes to hide the forms, not close them i.e. Me.Visible = False.

So, if the form is cancelled, it will no longer be open, but if it was OK'd,
then it will still be open (albeit invisible) and you can get whatever
values you need from it. You will need to close it when you're done.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top