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: -
DoCmd.OutputTo acOutputReport, "rptmouldcurrent", acFormatPDF, "C:\Temp\Test.pdf", False
-
works ok, but prints out all reports, not just the one I want.
So, I tired this: -
DoCmd.OpenReport "rptmouldcurrent", acViewPreview, , "[Mouldref]='" & Me.CboxMould & "'", acWindowNormal
-
-
DoCmd.OutputTo acOutputReport, "rptmouldcurrent", acFormatPDF, "C:\Temp\Test.pdf", False
-
-
DoCmd.Close acReport, "rptmouldcurrent"
-
But this causes Access to crash catastrophicall y.
Any ideas why its happy to deal with lots of reports, but just one flummoxes it?
3 1865 zmbd 5,501
Recognized Expert Moderator Expert
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. - Dim strSQL As String
-
strSQL = "[Mouldref]='" & Me.CboxMould & "'"
-
DoCmd.OpenReport ReportName:="rptmouldcurrent", View:=acViewPreview, WhereCondition:=strSQL, WindowMode:=acWindowNormal
-
I don't think you'll need the "[]"
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!
zmbd 5,501
Recognized Expert Moderator Expert
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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 Access! No
error message is given, the thing just vanishes! Why? How do I fix
this?
|
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 after applying the
filter.
See the steps to recreate bug below for details.
|
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 2000 file format)
that resides on a shared network drive. This OutputTo macro is
essentially setup to export one small table to an Excel spreadsheet
once a user clicks a command button on the switchboard. Another user
and I (both of us have...
|
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 it exists.
How do I get around this (as the file needs to exist for remote access almost 24/7 via an e-mail file-fetch program, but not be e-mailed to people daily - only when they want to see it)?
Thanks
Dman
|
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 - I can't find much info on
this... - Can someone explain what's happening and how to fix this?
Private Sub Form_Load()
'2008-01-11
Dim rsx As ADODB.Recordset
Set rsx = New ADODB.Recordset
rsx.CursorLocation = adUseClient
| |
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 this code in an mdb file, it executes with no problems.
When I execute the same function when compiled in an mde file, I get
Error Number "438" (Object doesn't support this property or method).
|
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
|
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 closed, data is saved to the database but the email is not sent. Here is the the code. If anyone has suggestions on how I can get Outlook to open before trying to send the email I would appreciate it.
Private Sub Approve_Click()
On Error GoTo...
|
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 anything like that, but I am curious whether I need to lock the socket access when i am sending. An oversimplified example of a single send would be like:
bool sendData(SOCKET sock, uint32_t size, const char * data)
{
uint32_t nSizeNetOrder =...
|
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 the codes so that i can open my report with filtered data in access 2007.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |