473,395 Members | 1,677 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,395 software developers and data experts.

Another stupid error 2501 question in REPORTS

Sorry for asking but I could not find any response and can only loop thru 25 pages every so often. I know this has been asked multiple times, but I cannot seem to find an answer that I haven 't used.

I use this type of coding when no data exists for a report, but on occasion, My error trapping does not work. I can see no rhyme or reason why it wouldn't.

MY CODE INSIDE THE REPORT MODULE IS:

Private Sub Report_NoData(Cancel As Integer)

Cancel = True
MsgBox "No Data To Report", vbExclamation, "Print Current Report"

End Sub

MY CODE FOR THE CLICK EVENT ON THE FORM THAT GENERATES THE REPORT IS:



Private Sub cmdPrintCurrent_Click()

On Error GoTo print_Err

DoCmd.OpenReport "rptUnprintedTimeReports", acViewPreview

print_Exit:
Exit Sub

print_Err:

Select Case Err.Number
Case 2501 ' openreport closed by user
Resume Next
Case Else
MsgBox "Error Number: " & Err.Number & vbCrLf & _
"Error Source: '" & Me.Name & ":cmdPrintCurrent_Click" & vbCrLf & _
"Error Message: " & Err.Description, vbCritical, "Error Printing Report!"
Resume print_Exit
End Select

end sub



ANY IDEAS?????

AL
Jul 25 '06 #1
0 1409

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ColinWard | last post by:
My previous message was blank so Im trying again. I have a button on a form which opens the Import dialogue box. This works fine except if I click on the "X" to close the form I get Run-Time Error...
1
by: Bob Dydd | last post by:
Hi everyone It's me again. I have an access 2000 database with 12 landscape reports which sometimes have to be FAXED and other times printed, so I have written the following code and put it...
5
by: fearblanco | last post by:
Hello - I am receiving the below error message when attempting to open a report. This database is used by approximately 20 users and only one user is having this problem (even I can't duplicate...
4
by: Keith | last post by:
I have the following code in the On No Data event of a report: **** On Error GoTo err_trap MsgBox "No items matching criteria.", vbInformation, gcApplication Cancel = True err_trap: If...
33
by: Anthony England | last post by:
I am considering general error handling routines and have written a sample function to look up an ID in a table. The function returns True if it can find the ID and create a recordset based on...
8
by: sara | last post by:
I have a report that runs fine with data. If there is no data, I have its NO Data event sending a MsgBox and cancelling the report. Then it seems I still get the 2501 message on the Open Report...
3
by: robertsheeran | last post by:
Hi all, I have an database created that I currently use on MS Access 02 and now want to use on a different computer with MS Access 03. All the reports and queries run perfect on Access 02 but...
1
by: Starasoris | last post by:
I have just nocked up a database for a client but when they preeview the reports, they get 2501 errors and when they try and print the reports, they get 3011 (object not found) errors. I imagine...
2
by: airdata | last post by:
Hi I currently have the following code attached to a command button on a switchboard form. This is basic Access 2000. Private Sub Print_daily_reports_button_Click() On Error GoTo NoData...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
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...
0
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...

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.