Rabu, 24 April 2013

Re: [MS_AccessPros] Do

 

John 
There was no code in the ON No Data event. So I added the code to cancel the report based on Duane's suggestions and I still get an error
 
Jim Wagner
________________________________

________________________________
From: John Viescas <JohnV@msn.com>
To: MS_Access_Professionals@yahoogroups.com
Sent: Wednesday, April 24, 2013 12:46 AM
Subject: RE: [MS_AccessPros] Do


 
Jim-

The most common cause of this sort of error is a Cancel in the report's No
Data event procedure. If your filter results in no records, the On No Data
event will fire, and if you have a Cancel in that, then that generates the
2501. I recommend adding an error trap in your code to ignore the 2501.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Duane Hookom
Sent: Wednesday, April 24, 2013 4:10 AM
To: Access Professionals Yahoo Group
Subject: RE: [MS_AccessPros] Do

Jim,

I expect the issue might be no records in rpt_33NewHires that match the
where condition. Then your report probably has an issue or closes on no
records and causes the error in the calling form.

I would check to see if the report's record source combined with the where
condition would return any records prior to attempting to open it.

Duane Hookom MVP
MS Access

----------------------------------------
> From: luvmymelody@yahoo.com
>
> I have this function that outputs a report as pdf to a folder location on
the network and the process stops on the the outputto line of code. I get a
run time error of 2501. The OutputTo action was canceled. When I hover over
the docmd.outputto in the highlighted line I see acOutput=3 which I am not
sure what that is. Below is part of the code and the last line is what is
highlighted. I have a feeling that it is the select statement that is
causing the issue. Is there a line in the select statement that I am
missing?
>
> Thank You
>
> Jim Wagner
>
> DoCmd.OpenReport "rpt_33NewHires", acViewPreview, _
> WhereCondition:="[Dept Id] IN (SELECT Department " & _ "FROM
> [tblPollyDepartments])"
> DoCmd.OutputTo acOutputReport, "rpt_33NewHires", "PDFFormat(*.pdf)",
> "\\Afwfs\AF\Services\UnivSrv\Admin Services\DATA MANAGEMENT
> SERVICES\Master PeopleSoft Tables\Repurpose Database\Department
> Reports\rpt_33FACMANNewHires.pdf", False, "", , acExportQualityPrint
>

[Non-text portions of this message have been removed]

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)
Recent Activity:
MARKETPLACE


.

__,_._,___

Tidak ada komentar:

Posting Komentar