Solved

Two forms open the same report

Posted on 2013-11-21
3
510 Views
Last Modified: 2013-11-22
Two forms can open the same report. When the report closes I want the form that opened the report to be re-opened. That is assuming that the form has to be closed before opening a report. One of the forms is a pop up and stays in front of the report until manually closed. So I have to close it first then open report. In the past I have copied the report renamed it and opened two different reports using the reports on close event to re-open the correct form, but that must be the wrong way to do it?

Access 2003
0
Comment
Question by:DatabaseDek
3 Comments
 
LVL 61

Assisted Solution

by:mbizup
mbizup earned 150 total points
ID: 39666998
You can use OpenArgs when you open the report:

DoCmd.OpenReport "reportname", WhereCondition := "Id = " & Me.ID, OpenArgs := Me.Name
DoCmd.Close acForm, Me.Name    '<--- close the form after opening the report.

And then in the close event of your report:

Docmd.OpenForm Me.OpenArgs
0
 
LVL 21

Accepted Solution

by:
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 350 total points
ID: 39667106
I avoid opening, closing, and reopening  Forms unless absolutely required for some reason. Most of the time there is really no good reason.

I like to just hide the form not close it  using:

Me.Visible = False

In the on close event I look to see which form is loaded and make it visible again.

Example:

If CurrentProject.AllForms("FormName1").IsLoaded = True Then
    forms("FormName1").Visible = True
End If

If CurrentProject.AllForms("FormName2").IsLoaded = True Then
    forms("FormName2").Visible = True
End If

Open in new window


I find this can also dramatically improve performance
0
 

Author Closing Comment

by:DatabaseDek
ID: 39668943
Brilliant, both.

Thanks you
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now