DoCmd.CloseReport "blah"

stapes

New member
Local time
Today, 17:46
Joined
Dec 4, 2006
Messages
6
Hi
The above doesn't work - I guess it is incorrect syntax.

I am running a script that needs to run a number of reports for several preceding periods and carry forward some totals to the following report.
The script accesses the report output like so:

PMinus3ESPAll = [Reports]![AS2]![ESPAllRatedGoods]

This works OK

The trouble is, on the next run, it still has this report open, so it doesn't bother to run the new one - and the values stay the same.

How do I close it to insure that each period of the report is run and it's values carried forward correctly.

Stapes
 
Why Not Use A Query To Get The Totals Of If It's That Complex A Function to do the sums then output the results to a report?

I would say opening and closing loads of reports like that will be slow.
 
Dreamweaver said:
Why Not Use A Query To Get The Totals Of If It's That Complex A Function to do the sums then output the results to a report?

I would say opening and closing loads of reports like that will be slow.

This is an accountancy application, and the calculations involved are far too complex for a single query. I solved the problem anyway. I was using the wrong syntax as expected. It should have been:

DoCmd.Close acReport, "blah"

Stapes
 
Last edited:
force the user to deal with /close the open report first

while isopen("myreport",acreport)
doevents
wend

this will pause after each instance of the report until its closed

i will post the isopen in a second

Code:
Function IsOpen(strName As String, Optional objtype As Integer = acForm)
   IsOpen = (SysCmd(acSysCmdGetObjectState, objtype, strName) <> 0)
End Function
 
gemma-the-husky said:
force the user to deal with /close the open report first
/QUOTE]

Hang on a minute - I'll just get the whip out.
 
Just asking but what would be the best way of doing this, as I've always used queries and if something was really complex I would write a function to get the numbers is that right or am I doing it wrong, I do understand everybody does things differently but I want to make sure I'm doing things the right way as I know there's loads around hear 100 times better than me hopefully somebody will put me right. Thanks

Sorry Stapes I did notice The Error with the close method after I had posted my message but got side tracked and forgot to come and sort it out
 

Users who are viewing this thread

Back
Top Bottom