Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 11-05-2015, 01:54 PM   #1
bayman
Newly Registered User
 
Join Date: May 2001
Location: richmond, ca, usa
Posts: 96
Thanks: 0
Thanked 1 Time in 1 Post
bayman
Question Opening a report results in error

I'm attempting to open a report with a simple command:

Code:
DoCmd.OpenReport "rptName", acViewPreview
Executing the command results in a 2501 error. If I open the report from the Navigation Pane, it opens as expected. I'm using Access 2010. I've added code to ignore the 2501 error, which results in nothing happening. Anyone have an idea as to why this might be happening?

Thanks in advance.

bayman is offline   Reply With Quote
Old 11-05-2015, 01:58 PM   #2
spikepl
Eledittingent Beliped
 
spikepl's Avatar
 
Join Date: Nov 2010
Location: San Serriffe
Posts: 6,144
Thanks: 77
Thanked 980 Times in 958 Posts
spikepl is a jewel in the rough spikepl is a jewel in the rough spikepl is a jewel in the rough
Re: Opening a report results in error

what is 2501 error
__________________

Don't tell us what did not happen.
Do you tell the mechanic about your car "it doesn't work" or vague stuff like:
I couldn't, No joy, To no avail, No go
, Incorrect, Wrong, Seems, Without success, It didn't let me, I/it failed.

Do tell us what did happen
:

I want this ... to happen, I attempted this ..., using this ... code and pressing these buttons, the system did this ... in response, and I got this ... error in this ... line.

Did it help? Pass it forward!

Joys of Access:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

spikepl is offline   Reply With Quote
Old 11-05-2015, 02:02 PM   #3
Cronk
Newly Registered User
 
Join Date: Jul 2013
Posts: 2,137
Thanks: 3
Thanked 466 Times in 459 Posts
Cronk will become famous soon enough Cronk will become famous soon enough
Re: Opening a report results in error

"Anyone have an idea as to why this might be happening?"

No, not with the negligible amount of information provided.

Did you try opening the report without the preview? Does the report contain any code? What is the recordsource for the report?

Cronk is offline   Reply With Quote
Old 11-05-2015, 03:00 PM   #4
bayman
Newly Registered User
 
Join Date: May 2001
Location: richmond, ca, usa
Posts: 96
Thanks: 0
Thanked 1 Time in 1 Post
bayman
Re: Opening a report results in error

Quote:
Originally Posted by spikepl View Post
what is 2501 error
Generic run-time error. The accompanying message is "The OpenReport action was canceled."
bayman is offline   Reply With Quote
Old 11-05-2015, 03:02 PM   #5
bayman
Newly Registered User
 
Join Date: May 2001
Location: richmond, ca, usa
Posts: 96
Thanks: 0
Thanked 1 Time in 1 Post
bayman
Re: Opening a report results in error

Quote:
Originally Posted by Cronk View Post
"Anyone have an idea as to why this might be happening?"

No, not with the negligible amount of information provided.

Did you try opening the report without the preview? Does the report contain any code? What is the recordsource for the report?

Tried opening without preview. Same error.

Report contains no code.

Recordsource is a linked SQL table.
bayman is offline   Reply With Quote
Old 11-05-2015, 06:54 PM   #6
sneuberg
AWF VIP
 
Join Date: Oct 2014
Location: Tucson, Arizona
Posts: 3,506
Thanks: 362
Thanked 976 Times in 943 Posts
sneuberg will become famous soon enough sneuberg will become famous soon enough
Re: Opening a report results in error

Probably won't help but try a compact and repair.
sneuberg is offline   Reply With Quote
Old 11-05-2015, 07:17 PM   #7
AccessBlaster
.
 
Join Date: May 2010
Posts: 1,144
Thanks: 27
Thanked 270 Times in 257 Posts
AccessBlaster has a spectacular aura about AccessBlaster has a spectacular aura about
Re: Opening a report results in error

Quote:
Originally Posted by bayman View Post
I'm attempting to open a report with a simple command:

Code:
DoCmd.OpenReport "rptName", acViewPreview
Thanks in advance.
Do you really have a report named rptName?

AccessBlaster is offline   Reply With Quote
Old 11-06-2015, 03:03 PM   #8
bayman
Newly Registered User
 
Join Date: May 2001
Location: richmond, ca, usa
Posts: 96
Thanks: 0
Thanked 1 Time in 1 Post
bayman
Re: Opening a report results in error

Quote:
Originally Posted by sneuberg View Post
Probably won't help but try a compact and repair.
Just closing and re-opening the database solved the problem. Amazing.

bayman is offline   Reply With Quote
The Following User Says Thank You to bayman For This Useful Post:
sneuberg (11-06-2015)
Reply

Tags
2501 , reports , vba

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error when opening report thmsjlmnt3953 Modules & VBA 1 11-29-2014 03:21 PM
Opening a Report off of Search Results Report sevanty7 General 3 05-27-2013 09:39 PM
Error msg for opening report zariazakeryzavien05 Reports 1 10-23-2009 07:52 PM
Error opening report wrekless Forms 2 08-23-2000 06:03 AM
Error opening report wrekless Reports 0 08-22-2000 10:11 AM




All times are GMT -8. The time now is 06:33 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World