Solved

access 2010 report - preview in popup window needs EXPORT button

Posted on 2013-01-28
12
1,187 Views
Last Modified: 2013-01-30
I have a report that opens in print preview mode in a popup dialog box.  It needs to have a button somewhere (either on report header or popup menu bar) that runs code to export report source to EXCEL.  I also have code in the report in the report-Format event.

I have all the reports in the application opening in a popup window in preview mode, and the user can right-click to print.

I currently have the EXPORT command button on the report header and it works fine, except that the button doesn't show in preview mode.  If I change the view to acViewReport, the button appears and works well, but the report_Format event hasn't run, so that code doesn't get executed.  (it sets the heading and date text fields on header section).  Also, I can't seem to change the size of the popup to fit the acViewReport so it doesn't look good.  

Any ideas how I can have an EXPORT to EXCEL button or similar and still show report in preview mode in the popup window?

Thanks.
0
Comment
Question by:MonkeyPie
  • 6
  • 6
12 Comments
 
LVL 84
ID: 38826030
There is no user interaction in Preview mode (i.e. you can't have buttons and such on a report  in Preview mode).

You could build a form with an embedded report, and place the button on the Form.

Or you could include the button on a ribbon control in Access, and let the user click it there.
0
 

Author Comment

by:MonkeyPie
ID: 38826231
How do you build a form with an embedded report?

Your second option - I think ribbon control in Access 2010 is tricky?
0
 
LVL 84
ID: 38826380
Add a Subform/Subreport to a form, and set the SourceObject to your Report. This can only be done in 2010.

I don't know what you mean by "tricky", but working with Ribbons generally will require you to do some research and 'homework'. I use this:

www.ribboncreator.com << 2007
www.ribboncreator2010.de/en/  <<2010
0
 

Author Comment

by:MonkeyPie
ID: 38829859
Thank you for help on form with report as subform.  I have done that.  The form is a pop-up and yes, the report shows in the form, and yes I can have a button on form to EXPORT.  But the report opens as acViewReport, not preview mode, and so the HeaderFormat event is not triggered.  Can I have the report showing in the form in preview mode?

Thank you.
0
 
LVL 84
ID: 38830100
Try setting the Default View of the REPORT to Print Preview. the "default" for the Default View is Report View.

To do that, open the report in Design and select the Default View in the Properties dialog.
0
 

Author Comment

by:MonkeyPie
ID: 38830118
Thanks for quick reply.  I did that and is still shows in report view, not preview.  I then tried setting property 'allow report view' to false and same result.
I really do want the report to show in preview mode, even if I take to code out of the header format event.  It needs to match all other reports in the app.
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 84
ID: 38830164
I'm not sure that you can ... from my review, the CurrentView of the report object is always 6 (i.e. ReportMode), no matter what you do.

Embedding Reports in forms is a very new concept, so you're going to run into some limitations. Try moving the code in the Format event out of that section (maybe to the Open or Load event of the report).

If that doesn't work, then you're stuck with the Ribbon ...
0
 

Author Comment

by:MonkeyPie
ID: 38830188
I am developing this application in 64 bit Office.  Do you know if the ribbon creator works in 64 bit?   I bought it ages ago, but haven't yet used it.
0
 
LVL 84
ID: 38830192
I don't know - but why are you using 64-bit Office? Even MSFT recommends using 32-bit unless you have a compelling reason to use the 64-bit versions (and there are none for Access development).
0
 

Author Comment

by:MonkeyPie
ID: 38830413
The client runs 64 bit Office and I am doing it to their spec.  They run huge complex EXCEL spreadsheets, I believe,  hence 64 bit Office needed.

It has caused several problems for me, but so far I have been able to work around most of them.
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 38830526
I see ...

I don't think you'll be able to get around the Preview Mode requirement. From what I've found, that is the default (and only) mode for embedded reports.
0
 

Author Closing Comment

by:MonkeyPie
ID: 38837139
OK.  Thank you for determining that preview mode of report won't work as form subform.  Also that command buttons won't work in report VIEW mode.  I will need to find another solution.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

708 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

13 Experts available now in Live!

Get 1:1 Help Now