Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XP Report open bug?

Status
Not open for further replies.

danvlas

Programmer
Jul 30, 2002
2,446
RO
Hi everyone.

I have the following code:

Code:
strReportName = rptActiveReport.Name
DoCmd.OpenReport strReportName, acViewNormal

rptActiveReport is a Report variable that refers to an open report

The code is supposed to print the report and it does. However, after printing the report opens in Design view.
Tried the same code in Access 2003 and 2007 and it works great.
Anyone knows a fix for it? (I found a workaround, but I don't like it, so I won't post it).

Thank you in advance,



[pipe]
Daniel Vlas
Systems Consultant

 
I have heard stories of 'invisible' break-points left over from earlier testing ... [ponder]
 
Thanks for the reply.
Unfortunately, it's not the case.
Tried decompile, importing all objects in a new file, compact, repair, everything I could think of.
And it works so well in all other versions.

The funnyiest thing is that it opens in Design View even in an mde file [surprise]

It's not a bug, it's an undocumented feature...

The solution I found is against all principles, but there was nothing better I could find:

Code:
strReportName = rptActiveReport.Name
Echo False
DoCmd.Close acReport, strReportName
DoCmd.OpenReport strReportName, acViewNormal
DoCmd.OpenReport strReportName, acViewPreview
Echo True

Of course if user scrolls to page 20 of the report he will see the first page after printing, but that's it...



[pipe]
Daniel Vlas
Systems Consultant

 
can you post more than just that snippet of code?

I suspect what you are doing is declaring an report object, then setting a report to the report object, and then opening that object and printing the report...

you could try to loop through either the screen collection or the allreports collection and detect which reports to be active, and then use the docmd.openreport "reportName" directly, without having to go through an object...

--------------------
Procrastinate Now!
 
Well, thanks for the intention, but there is nothing one can do about the variable.
The application has a touch screen pad that has a 'Print' button. There may be several reports displayed, user just activates one and then touches 'Print'.
To print that report, the button should know its name and that is taken from the variable (which is set in the Activate event of each report)
Therefore, the simple instruction that I first posted is supposed to send the report to the print
er, and it does.
What is stumping is that after printing, the report stays on the screen IN DESIGN VIEW, even in an mde file.
And this happens only in Access XP.
Hope it's clearer now...

[pipe]
Daniel Vlas
Systems Consultant

 
well, how's about putting a close clause after the printing of the report?

if reports("reportName").isloaded then
docmd.close acreport, "reportName", acsaveno
end if

or something like that...

--------------------
Procrastinate Now!
 
Can the report be designed in the design mode? This might open up a world of possibilities for MDE's.


Mark P.
Providing Low Cost Powerful Point of Sale Solutions.
 
Well, you can:

- change the properties of existing controls
- remove controls
- change the properties of the report and its sections (record source, colours)

You cannot:
- add new controls
- view/change code (Project is unviewable)

Anyway, this is only possible in Access XP and only by opening the report once in Preview mode and then, without closing it, open it again in Normal mode to send it to the printer.

Code:
DoCmd.OpenReport "R_In", acViewPreview
DoCmd.OpenReport "R_In", acViewNormal

The 'Design' menu is unavailable.

Haven't found the answer yet...still searching.



[pipe]
Daniel Vlas
Systems Consultant

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top