473,320 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

OutputTo acreport crashes access when filtered

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
3 1848
zmbd
5,501 Expert Mod 4TB
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
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
5,501 Expert Mod 4TB
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

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

Similar topics

2
by: Jonathan Goldman | last post by:
Hi- I have a relatively simple report that I open in an Access '97 VBA procedure, using the Docmd.OpenReport "rptName", acViewNormal syntax. The problem is that doing this usually crashes...
0
by: Malcolm Cook | last post by:
I've discovered: Using "File > Print Preview" in a form's datasheet view with a server Filter crashes access after previewing... ....that is, unless ServerFilterByForm has been turned off...
1
by: paul.hanti | last post by:
This board has been a plethora of information. Thanks to all that respond! I have a quick question regarding the built-in OutputTo macro. I've built a shared database in Access 2003 (in Access...
1
by: dman1967 | last post by:
Trying to save a daily scheduled query result to an Excel file on the server. Runs fine the first time, or when file is deleted, however, it stops waiting for input to say "Yes" to overwrite it, once...
2
by: curran.george | last post by:
'add one textbox to form1 with Control Source property = ID 'copy/paste the form_load code below: 'Then open the form and then attempt to sort the datasheet 'crashes 2003, error 3450 Access 2007 -...
2
by: Icarus | last post by:
I have a function in Access 2007 that runs the following code: DoCmd.OutputTo acOutputReport, "rpt-TOC Summary", "Rich Text Format (*.rtf)", "C:\TOC\Working\PRE-X08-0295.doc", False When I run...
4
by: frys | last post by:
Every time i attempt to delete a record access crashes i have a main form a sub form and a sub sub form
6
by: dlblack | last post by:
I am using the following code to send emails with attachments from Access using Outlook. The code works fine if Outlook is already open and emails are sent as expected via Outlook. When Outlook is...
2
emibt08
by: emibt08 | last post by:
Hi, I have an application that I recently revised. It transfers data between 2 programs, including files as well as small data chunks. I never had a problem (got garbage at the other side) or...
0
by: sarvmardan | last post by:
how to open a report in access containing filtered data using two combo boxes on form and a button to click. let i have two fields and other is . two comboboxes are combo11 and combo9. plz post...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.