By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,826 Members | 2,443 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,826 IT Pros & Developers. It's quick & easy.

OutputTo acreport crashes access when filtered

P: 94
I need to only print one page of a report, not the whole thing, but do so automatically. Annoyingly, I can't seem to get it to work!

This:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OutputTo acOutputReport, "rptmouldcurrent", acFormatPDF, "C:\Temp\Test.pdf", False
  2.  
works ok, but prints out all reports, not just the one I want.

So, I tired this:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "rptmouldcurrent", acViewPreview, , "[Mouldref]='" & Me.CboxMould & "'", acWindowNormal
  2.  
  3. DoCmd.OutputTo acOutputReport, "rptmouldcurrent", acFormatPDF, "C:\Temp\Test.pdf", False
  4.  
  5. DoCmd.Close acReport, "rptmouldcurrent"
  6.  
But this causes Access to crash catastrophically.
Any ideas why its happy to deal with lots of reports, but just one flummoxes it?
Jan 14 '14 #1
Share this Question
Share on Google+
3 Replies


zmbd
Expert Mod 5K+
P: 5,397
at which line is it crashing?
place a STOP command at the begining of the procedure, once the code enters debug mode, [F8] to step thru the code till error.

>>Edit>> Also move your Where String out of the function and build it first. This way we can troubleshoot it.
Expand|Select|Wrap|Line Numbers
  1. Dim strSQL As String
  2. strSQL = "[Mouldref]='" & Me.CboxMould & "'"
  3. DoCmd.OpenReport ReportName:="rptmouldcurrent", View:=acViewPreview, WhereCondition:=strSQL, WindowMode:=acWindowNormal
  4.  
I don't think you'll need the "[]"
Jan 14 '14 #2

P: 94
I'm not sure at which point the code crashes, it doesn't enter debug mode, Access stops working, and needs to be shutdown.

It would be much simpler to sort if it crashed normally!
Jan 15 '14 #3

zmbd
Expert Mod 5K+
P: 5,397
that's fine

please do as I suggested with the stop command, this forces debug mode at that point.

I cannot help you, nor can anyone else, if you ignore our requests.
Jan 15 '14 #4

Post your reply

Sign in to post your reply or Sign up for a free account.