Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 832
  • Last Modified:

Access 2007 acOutputReport

I have the following code:

DoCmd.OutputTo acOutputReport, "rptBreakdown10Snapshot", acFormatSNP, ReportFinal

It worked  in 2003 but now I can't get it to work in 2007. I keep getting the following error. I have tried downloading the snapshot view and adding it to my reference library in Access 2007 and it still will not work.

Run-Time error '2501':
The OutputTo action was canceled.

Thanks

0
LeLeBrown
Asked:
LeLeBrown
  • 4
1 Solution
 
LeLeBrownAuthor Commented:
I did some testing and if I remove the DoCmd.OutputTo acOutputReport, "rptBreakdown10Snapshot"  from the statement and select snapshot viewer and then type the file name in, it works. I can also leave the statement like this: DoCmd.OutputTo acOutputReport, "rptBreakdown10Snapshot", ,ReportFinal (Report Final being the file name) and it will work. It doesn't seem to like the acFormatSNP.


0
 
LeLeBrownAuthor Commented:
Ignore last post. I meant to say if I remove the acFormatSNP from the DoCmd statement it works. I just have to select Snapshot from a menu that pops up. I have over 3500 reports though so this will not work for me.

0
 
LeLeBrownAuthor Commented:
Once again. Ignore my last post... the problem seems to be with the ReportFinal variable that holds the file name.
This Does NOT work:
DoCmd.OutputTo acOutputReport, "rptBreakdown10Snapshot", acFormatSNP, ReportFinal
This DOES work - but I have to name each individual file:
DoCmd.OutputTo acOutputReport, "rptBreakdown10Snapshot", acFormatSNP

This worked fine in 2003 or maybe it was because it was on a different machine. Do you have to set certain reference libraries in order to have it save?

0
 
LeLeBrownAuthor Commented:
Nevermind.... I found the problem.
0
 
Helen FeddemaCommented:
Just a thought -- if you are running Access 2007, it is generally a good idea to output to PDFs rather than snapshots, because PDFs are more widely useful.  Here is some code for outputting a report to a PDF file:


DoCmd.OutputTo acOutputReport, "rptInvoice", _
      acFormatPDF, "Invoice.pdf", True

Open in new window

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now