• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 617
  • Last Modified:

Closing a form and report

Hi all,

My Problem.

I have a Main Form from where I can click on a button which takes me to another form, i.e. Report Menu.

In this Report Menu I can enter a date range i.e. a Start date and and an End Date and preview a Report based on that criteria.

To preview the report I run a macro which opens the Report and then Hides the Report Menu and then maximizes the report.

The reason I do this is because I want the Report Menu Form to continue running in hidden mode so that the report can continue running based on the date criteria entered in the Report Menu form.

My problem now is closing the Report and Report Menu form in such a way so that when  I Close the report the underlying form i.e. the Report Menu will also close so that when I re-enter the Report Menu via the Main Menu the Report Menu date range does not retain the date range that I entered previously.

Any Ideas welcomed..
0
PipMic
Asked:
PipMic
  • 3
  • 2
1 Solution
 
ienaxxxCommented:
Hi,
what about adding javascript on the onclose event?
Is that feasible?

https://developer.mozilla.org/en-US/docs/DOM/window.onclose
0
 
Dale FyeCommented:
You can use the Report_Close event.

Private Sub Report_Close

    if currentproject.allforms("frm_Report_Menu").isloaded then
        docmd.close acform, "frm_Report_Menu"
    end if

End sub
0
 
PipMicAuthor Commented:
Hi,

My eport Menu form is called "Report Menu"...

I tried the following:-


Private Sub Report_Close()

 If currentproject.allforms("Report Menu").isloaded Then
        DoCmd.close acForm, "Report Menu"
    End If


End Sub

I get a

 Compile Error
Variable not defined

?? (Forgot to mention that I use A97 and A03) - I always forget to mention this!!!!
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Dale FyeCommented:
Where did you put the code (in the report or in the form)?

Which line was highlighted when the error occurred?  Try compiling your code, that should highlight the offending line of code, maybe you misspelled something.
0
 
PipMicAuthor Commented:
Hi,

Got it to work....

Used an adaptation of the code used ie

Private Sub Report_Close()

        DoCmd.close acForm, "Report Menu"
 
End Sub

Thanks fyed
(Strange because I had tried something similar earlier!!!!)
0
 
PipMicAuthor Commented:
used part of the code thanks....
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now