Close all reports

Hello All

I have a form with a combobox and various buttons: the user opens various
reports in preview by clicking on the appropriate buttons.
The reports use the value in the combobox as a parameter.
The problem is that sometimes the user does not close a previewed report
before changing the value in the combobox, and then when they click the
button for the report that is already open they do not get the correct
report.
Is there a way to put some code behind the combobox (as the before or after
update event) that will close all the reports that are open?
This strikes me as the best way to solve the problem ... if there is a
command that will do it!

Hope someone can help
Many thanks
Les



0
Leslie
5/24/2007 3:04:34 PM
access.reports 4434 articles. 0 followers. Follow

4 Replies
728 Views

Similar Articles

[PageSpeed] 36

Leslie Isaacs wrote:
>I have a form with a combobox and various buttons: the user opens various
>reports in preview by clicking on the appropriate buttons.
>The reports use the value in the combobox as a parameter.
>The problem is that sometimes the user does not close a previewed report
>before changing the value in the combobox, and then when they click the
>button for the report that is already open they do not get the correct
>report.
>Is there a way to put some code behind the combobox (as the before or after
>update event) that will close all the reports that are open?
>This strikes me as the best way to solve the problem ... if there is a
>command that will do it!


Ignoring the issue of multiple instances of a single report,
you can close all open reports by looping through the
Reports collection.

Dim k As Integer
For k = Reports.Count -1 To 0 Step -1
	DoCmd.Close acReport, Reports(k).Name, acSaveNo
Next k

-- 
Marsh
MVP [MS Access]
0
Marshall
5/24/2007 4:22:52 PM
Klatuu

Thanks for your reply.

I have used the DoCmd.Close method before, but as far as I'm aware I can 
only use this when I know the name of the open report/s.

I don't think I can keep track of which reports are open.

I was hoping for a way of just closing whichever reports happen to be open - 
without having to identify them.

Is this possible?

Thanks again

Les



"Klatuu" <Klatuu@discussions.microsoft.com> wrote in message 
news:4B940800-CC7A-4D5C-8F1D-184E0EDD8868@microsoft.com...
> Use the DoCmd.Close method to close the reports (see VBA Help on Close 
> method
> for details)
> You will just need to keep track of which reports are open so you can 
> close
> them.
> -- 
> Dave Hargis, Microsoft Access MVP
>
>
> "Leslie Isaacs" wrote:
>
>> Hello All
>>
>> I have a form with a combobox and various buttons: the user opens various
>> reports in preview by clicking on the appropriate buttons.
>> The reports use the value in the combobox as a parameter.
>> The problem is that sometimes the user does not close a previewed report
>> before changing the value in the combobox, and then when they click the
>> button for the report that is already open they do not get the correct
>> report.
>> Is there a way to put some code behind the combobox (as the before or 
>> after
>> update event) that will close all the reports that are open?
>> This strikes me as the best way to solve the problem ... if there is a
>> command that will do it!
>>
>> Hope someone can help
>> Many thanks
>> Les
>>
>>
>>
>> 


0
Leslie
5/25/2007 3:09:35 PM
Marshall

Thanks for your reply: your code worked brilliantly!!
That will be very useful for me.

Thanks again
Les



"Marshall Barton" <marshbarton@wowway.com> wrote in message 
news:7jeb5350in7rj448iuo5r5dkuoerlul28u@4ax.com...
> Leslie Isaacs wrote:
>>I have a form with a combobox and various buttons: the user opens various
>>reports in preview by clicking on the appropriate buttons.
>>The reports use the value in the combobox as a parameter.
>>The problem is that sometimes the user does not close a previewed report
>>before changing the value in the combobox, and then when they click the
>>button for the report that is already open they do not get the correct
>>report.
>>Is there a way to put some code behind the combobox (as the before or 
>>after
>>update event) that will close all the reports that are open?
>>This strikes me as the best way to solve the problem ... if there is a
>>command that will do it!
>
>
> Ignoring the issue of multiple instances of a single report,
> you can close all open reports by looping through the
> Reports collection.
>
> Dim k As Integer
> For k = Reports.Count -1 To 0 Step -1
> DoCmd.Close acReport, Reports(k).Name, acSaveNo
> Next k
>
> -- 
> Marsh
> MVP [MS Access] 


0
Leslie
5/25/2007 3:13:00 PM
Klatuu
I have just seen and used Marshall's method, which gave me exactly what I 
wanted.
Thanks again for your help.
Les


"Leslie Isaacs" <leslie.isaacs@gp-n85011.nhs.uk> wrote in message 
news:%23ZgI36tnHHA.3952@TK2MSFTNGP03.phx.gbl...
> Klatuu
>
> Thanks for your reply.
>
> I have used the DoCmd.Close method before, but as far as I'm aware I can 
> only use this when I know the name of the open report/s.
>
> I don't think I can keep track of which reports are open.
>
> I was hoping for a way of just closing whichever reports happen to be 
> open - without having to identify them.
>
> Is this possible?
>
> Thanks again
>
> Les
>
>
>
> "Klatuu" <Klatuu@discussions.microsoft.com> wrote in message 
> news:4B940800-CC7A-4D5C-8F1D-184E0EDD8868@microsoft.com...
>> Use the DoCmd.Close method to close the reports (see VBA Help on Close 
>> method
>> for details)
>> You will just need to keep track of which reports are open so you can 
>> close
>> them.
>> -- 
>> Dave Hargis, Microsoft Access MVP
>>
>>
>> "Leslie Isaacs" wrote:
>>
>>> Hello All
>>>
>>> I have a form with a combobox and various buttons: the user opens 
>>> various
>>> reports in preview by clicking on the appropriate buttons.
>>> The reports use the value in the combobox as a parameter.
>>> The problem is that sometimes the user does not close a previewed report
>>> before changing the value in the combobox, and then when they click the
>>> button for the report that is already open they do not get the correct
>>> report.
>>> Is there a way to put some code behind the combobox (as the before or 
>>> after
>>> update event) that will close all the reports that are open?
>>> This strikes me as the best way to solve the problem ... if there is a
>>> command that will do it!
>>>
>>> Hope someone can help
>>> Many thanks
>>> Les
>>>
>>>
>>>
>>>
>
> 


0
Leslie
5/25/2007 3:14:30 PM
Reply:

Similar Artilces:

Income & Expenses Report
I am confused by the Transfers at the end of the Income & Expenses report. It seems to double count on the bottom line. If I purchase $1000 in stock from my savings, the transfer shows a -$1000 (negative because I have taken $1000 out of my cash and transfered it to an investment). If I sell that stock for $1500. My report shows $500 capital gain in income, and a positive tranfers of $1500 (positive because I have transfered the money back into my cash). However these are added and thus shows a positive $2000 on the bottom line. It doubled the bottom line impact of the capital...

Reports for Manufacturing
Good afternoon ¿What option define the reports of manufacturing to print?. In Great Plains this option is in Setup>>Posting>>Posting. In manufacturing is there the same option? Thanks! ...

Code Comment Web Report,
I have enabled VC++ XML comments in Visual Studio 2005. However, I do not see the "Build Comment Web Pages" under the Tools file menu (which my book says should be there--but the book was written for VS02). Did they get rid of Build Comment Web Pages in VS05, or simply move it? > I have enabled VC++ XML comments in Visual Studio 2005. However, I do not > see the "Build Comment Web Pages" under the Tools file menu (which my book > says should be there--but the book was written for VS02). Did they get rid > of Build Comment Web Pages in VS05, or simply ...

Sums and percentages in reports
I have the following field in report's detail area: =Count([Cause]=1) (where 1 refers to a row of a table's dropdown) at the report footer I have the following sum for that column: =Sum(Abs([Cause]=1)) with the Runnin Sum - Over All. The calculation comes out correc so I'm assuming the formulas are correct. However, when I try to get a Percentage by deviding the field formula with the footer formula I don't get the correct answer. Can someone help me with this formula? You have told us what you attempted but it isn't clear what you want to accomplish. Your expres...

Reporting software
What kinda reporting software out there that people are using? I would like to be able to see who is sending/recieving the most mail internally and to the internet. I also would like to be able to see how much mail is being sent to my distribution lists. I am looking at a couple different products I found on msexchange.org's website but any info/advice would be appreciated. Thanks in advance. Jason On Mon, 28 Feb 2005 08:49:25 -0600, "JasonMeyer" <jason.meyer@nospam.isd623.org> wrote: > >What kinda reporting software out there that people are using? I woul...

Problem closing Outlook
Hi everyone, I have problems when I want to close my Micrsoft Outlook 2000. When I close it, it get hang up with the message "closing microsoft outlook 2000". I read somewhere about disable "send and recieve when exit" option to solve this problem, I know where to find it on 2003 version, but I didn't found it on 2000 version. Someone know where I can find it??? Thanks in advance and happy new year!!! Gregorio Aranda. P.S.: Sorry for my awful english Try the following: 1. Switch to Corporate/workgroup mode & create new profile and check if outlook works fine...

Report Setup
Hi! I'm trying to create an Access report that looks much like a mail merge. I've got a letter that needs to go to school districts (one letter per district) that lists the schools in the district. The report will also contain mailing data - district name, administrator name, and address - while later in the letter it will list the county the district is in, the school district and the respective schools. I'm having trouble getting the sorting right so that I only get one letter per district regardless of the number of schools in the district. Any thoughts? Thanks, Betsy On ...

Linking queries on a report
Hello all, I built a number of queries that all tie to the same table. Each query sorts the data differently, but comes from the same data source. I would like to show the results of these queries on the same report, but I get and error message that the wizard can't connect the queries. How can I display multiple queries on the same report. I've tried subreports, but they don't seem to export as well. Thanks b Brennan What does "export" have to do with this? If I have multiple sets of results I want to show in one place, I create an empty "main"...

Parameterized Report
Hi all! Does anyone know how to send parameter eg. invoiceid to the custom report in MSCRM? I want to be able to display crystal report of a selected invoice by clicking a button in the CRM toolbar. Any help is greately appreciated. Thanks in advance. Rgds, Christine ...

How to make MSO close the imap connection after checking mail?
Hi, My server does not allow "idle" connections, and therefore the connection to Microsoft Outlook is closed after a while. I then get a error-message from MSO. How can I make Microsoft Outlook close the connection itself after checking mail? (and thereby I will not get that error?) Regards, �ystein Larsen ...

Kits in Sales Report
Is there a way for a kit to be broke out on the detailed sales report to refect the items that were sold instead of the acual kit? I hate to open a can of worms here, but you could do it by changing the query in the report (Sales - Detailed Sales Report.qrp, I believe) and then you can alter the columns to reflect the new query. -- -Jerry JR Data Inc. "annihil8or@msn.com" wrote: > Is there a way for a kit to be broke out on the detailed sales report to > refect the items that were sold instead of the acual kit? did you find a way to list kit sales details? -- Lasting...

Modified Reports Fonts
We are running Great Plains 7.5 on Terminal Server 2000 and on client PCs running Windows XP Pro. From a Terminal Server install, user A has been printing a modified report (cash requirments) for a couple years with a readable font. Recently we installed GP on her local machine. Now when she prints, the font is somewhat readable but noticably different then the terminal server GP. She is using the same printer and print drivers from both locations. User B prints the same modified report from terminal server and from a local install and prints to the same printer as user A, but has ...

Report Asking For a Parameter
So I had a report that called with its Record Source set to TableA. I then made a copy of this report, but change the Record Source to TableB. TableB is a summary of TableA, and is missing one field, NAME So when I run my report, it pops up asking for the paramater for NAME. I looked at the report and deleted the feild that was linked to NAME. The report is still asking for NAME, even though no feilds on the report ask for it now. How do I go about fixing this? On Mon, 3 Mar 2008 15:19:03 -0700, "James" <fake@email.com> wrote: NAME (which by the way is a Reserved Wor...

FRx errors with emailing reports
A customer is receiving error messages when emailing FRx reports - they don't seem to affect anything, the reports are sent and received via email and FRx doesn't close but with every report that they send, they get the same message. "Drill Down Viewer has encountered a problem and needs to close. We are sorry for the inconvenience." DrillDown Viewer closes, FRx remains open. We have checked all of the settings to enable email, everything seems to be OK and the reports do get sent, just an annoyance having the message pop up every time. Has anyone seen this before...

Customer Statement Crystal Report
Hi! Does anyone have a Customer Statement in Crystal format? Thanks -- Marisol Mortera Marisol, Your question is very generic. If you could be a little more precise, then I might have what you need. Girish "Marisol" wrote: > Hi! > > Does anyone have a Customer Statement in Crystal format? > > Thanks > -- > Marisol Mortera I am trying to build a crystal report for customer statements as well. The Great Plains one is very difficult to work with. If you have an example of this report in crystal, please email it at staceyleelee@hotmail.com Stacey &quo...

Removing Subreport from Main Report
Hi All~ I have a main report that contains 6 subreports. Each subreport has a graph in the detail section and information in the report header (which is needed to clarify each graph). If there is no data in the graph, I want to remove the entire subreport (and basically allow the one below to "move up"). I have tried playing with the NoData event of the subreport but since there is info in the report header it does not ever seem to work. I think i need some type of code on the OnOpen event of the main report that verifies if there is data in the subreport graph and if not...

Hiding a "Userform" instead of closing it???
I have a push button on my spreadsheet which loads my Userform in the following manner: Sub Button1_Click() UserForm1.Show (vbModeless) ' Display my Userform End Sub When a user presses the "X" button on the Userform object I believe that Excel will terminate the Userform instead of simply "hiding" it by making it invisible. How can I program my Userform to turn invisible instead of terminating itself?? I would rather have the Userform turn invisible so it can maintain its current position on the screen when it is re-activated again..... I not...

Report Total Broker Commissions for year
Hi: I can't seem to figure out how to get a report on my investments with a broker how much I paid them in commissions for the year. I entered the commission with each buy or sell transaction from the confirmation statement from the broker so I know the data is there. -- Betty In microsoft.public.money, Betty wrote: > > >I can't seem to figure out how to get a report on my investments with a >broker how much I paid them in commissions for the year. I entered the >commission with each buy or sell transaction from the confirmation statement >from the broker s...

Michigan Wage Report
Is it possible to create the Michigan Quarterly Wage for electronic filing in GP 9.0? I am going to write a app in MS Access to create it, but wanted to check if it is available elsewhere. ...

Cannot export to Excel in Crystal report (cr8)
Hi, I have an application written in vb6 and uses cr8 Crystal report. In the past, the end users were able to export the report to Excel...They have an option of Exporting to Excel 5, 7 and 8. But lately, they were not able to do so, export to Excel will just close the application down without any warning. We all currently have Office 2007 installed, and I am not sure if that is the cause of the issue. But when I export the report from my development machine I have this option to pick "Excel 97-2000" (I don’t' see the "Excel 5, 7, 8" option at all)...

Report names in listbox
I recently upgraded to Access 2007 and am having some trouble with the changes. I have a form with a listbox in which I would like to display the names of all the reports in the database. I've tried using the following as the rowsource for the listbox, but in form view nothing is displayed. Does anyone know how to do this? TIA, Ken Warthen kenwarthen@gmail.com "SELECT MSysObjects.Name FROM MSysObjects WHERE (((Left([Name],1))<"~") AND ((MSysObjects.Type)=-32764)) ORDER BY MSysObjects.Name;" I think you made a slight typo. Try (((Left([Name],1))<>&quo...

zeros in the report
Reports-Sales-SalesAnalysis-AccountDue This report is showing item where the invoices are paid and the balance due is zero, making it a very long report. I have tried remove paid transactions and and reconcilling but neither works to handle this problem. Any ideas? Thanks Leslie May we assume that you selected to exclude zero balance accounts in the Sales Analysis Report Options window? "LASM" wrote: > Reports-Sales-SalesAnalysis-AccountDue > > This report is showing item where the invoices are paid and the balance due > is zero, making it a very long repor...

2007 Tries to update closed accountq
Ok i have a closed account at my bank and microsoft money 2007 keeps trying to update it when I do my online updates. Its not a big deal and causes not errors to pop up but it is kind of annoying. I do have open accounts at that bank as well In microsoft.public.money, z3razerviper wrote: >Ok i have a closed account at my bank and microsoft money 2007 keeps >trying to update it when I do my online updates. Its not a big deal and >causes not errors to pop up but it is kind of annoying. It is. On the Account List, select SortAccountListBy->HideClosedAccounts You can customize rep...

Reporting Sevices help!!!
Hi Guys, I need to know if there is a way to change the Reporting Services Reports in CRM to swith the est. Revenue field used to a seperate field. I'm doing a multi currency customisation all my user will be using different currency price lists e.g. euro price list, yen price list etc. I'm then doing a calculation to take each account opportunities etc est. revenue and put it in usd which is the reporting currency. the usd est revenue is stored in a seperate field calle new_estrevenueusd and i want this field to be used for all reports instead of the original est. revenue fiel...

Report Writer Functions #2
Where can I find instructions and examples on the various report writer functions? I've installed the SDK but I don't see anything there. The Report Writer On-line manual (Help - Printable Manuals - Reporting - Report Writer) has a fairly good description of the functions in Chapter 6. Do you look there or is there a specific function that you did not find there for which you are searching? "Elaine" wrote: > Where can I find instructions and examples on the various report writer > functions? I've installed the SDK but I don't see anything there. Hi El...