Ms Access Trap Error 2501
Contents |
question and get tips & solutions from a community of 418,595 IT Pros & Developers. It's quick & easy. Trapping Error 2501 P: n/a Keith I have the following code in the On ms access error 2501 the openform action was cancelled No Data event of a report: **** On Error GoTo err_trap MsgBox "No items
Ms Access Run Time Error 2501 The Outputto Action Was Canceled
matching criteria.", vbInformation, gcApplication Cancel = True err_trap: If Err.Number = 2501 Then Exit Sub **** When the code pointer returns to the error 2501 access calling line: **** DoCmd.OpenReport Forms(gcFrmPrint).lstReport.Column(1), acViewPreview, , strCriteria **** error 2501 is raised, even though I'm trapping for it both in the calling procedure and the report code. Am I missing something obvious? I'm guessing I
Access 2010 Error 2501
am :o0 Regards, Keith. Nov 13 '05 #1 Post Reply Share this Question 4 Replies P: n/a Justin Hoffman "Keith"
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn
Run Time Error 2501 The Save Action Was Canceled
more about Stack Overflow the company Business Learn more about hiring developers or
Run Time Error 2501 The Runcommand Action Was Canceled
posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community vba error handling Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Handling an output error in Access up vote 0 https://bytes.com/topic/access/answers/209615-trapping-error-2501-a down vote favorite I'm generating a query and report through VBA. I have an option of asking the user if they want to output the report as a snapshot. I first ask them if they want to make a snap shot. If they say no, nothing happens. If they say yes, they get a prompt asking where they want to save it. Everything works great except if they http://stackoverflow.com/questions/1111825/handling-an-output-error-in-access say yes and then click Cancel on the prompt, it raises a runtime error 2501 saying the report action was cancelled. Here is the code. DoCmd.OpenReport "CONCERNS", acViewPreview, lstFee.Value & " DETAILS" If MsgBox("Do you wish to create a snapshot of this report?", vbQuestion + vbYesNo) = vbYes Then DoCmd.OutputTo acReport, "CONCERNS", "SnapshotFormat(*.snp)", "" End If This is also the end of my procedure so I don't really care if an error happens here since all the important stuff happened already. I just know some monkey somewhere will flip if they ever see it. Is there a way to handle this error? On Error Resume Next is not an option because that would make debugging a nightmare in the future. It sounds like I'm looking for something like a Try/Catch but I don't think VBA supports that. ms-access vba error-handling share|improve this question edited Jul 10 '09 at 20:40 asked Jul 10 '09 at 20:31 mandroid 97731328 add a comment| 3 Answers 3 active oldest votes up vote 0 down vote accepted There are (at least) two ways to handle this. 1> get the filename and handle possible cancellation in a step before sending the report snapshot. I haven't done this r
Search Community Links Social Groups Pictures & Albums Members List Calendar Search Forums Show Threads Show Posts Tag Search Advanced Search Find All Thanked http://www.access-programmers.co.uk/forums/showthread.php?t=122481 Posts Go to Page... Page 1 of 2 1 2 > http://www.utteraccess.com/forum/index.php?showtopic=2026462 Thread Tools Rating: Display Modes 02-05-2007, 02:33 PM #1 ShanVel ShanMug Join Date: Oct 2005 Location: Akron, OH, USA Posts: 51 Thanks: 0 Thanked 0 Times in 0 Posts Run-time error 2501; OpenReport action was cancelled Folks, Need your help. I searched the entire error 2501 forum and found couple of postings on this, but none of them indicates if there is any fix for this problem. If there is no data, basically I want to show a message and close the report. I have some code to handle this under no data event like below: Private Sub Report_NoData(Cancel As Integer) MsgBox "There is no data error 2501 the for this report. Canceling report..." Cancel = True End Sub But this 2501 always pops up and I couldn't find a way to stop this. I also searched Microsoft knowledgebase, no help. Here's how my clik event procedure looks like: Private Sub cmdSearch_Click() On Error GoTo Err_PreviewRprt Dim strTbl As String Dim strSQL As String Dim strOptItem As String Dim strOptBlrType As String Dim strMsg As String, strTitle As String Dim intStyle As Integer 'Set up SQL statement for report record source If IsNull(optCriteria) Then optCriteria = 1 strTbl = Me.cboTypeOfGuar.Column(0) strOptItem = Choose(optCriteria, "memPred", "memGuar", "memRiskLevel", "memLDs") strOptBlrType = Choose(optBoilerType, "SWUP", "RB", "CFB", "All") strSQL = "SELECT tblProjts1.chrProjectName, tblProjts1.chrBlrPropNum, tblProjts1.chrBoilerType, " & _ strTbl & ".memGuranItem, " & strTbl & "." & strOptItem & _ " FROM tblProjts1 INNER JOIN " & strTbl & " ON " & _ "tblProjts1.intProjectId = " & strTbl & ".intProjectId" & _ " WHERE (((" & strTbl & ".memGuranItem)" & " IS NOT NULL)" & " AND " & "((tblProjts1.chrBoilerType) = '" & strOptBlrType & "'))" 'Open report in Design vie
Custom Search UtterAccess Forums>Microsoft® Access>Access Errors + Error Handling2 Pages 12> (Go to first unread post) Error 2501 Popping Up When It Never Did Before, Access 2010 Forum HomeSearchHelpUA Messages|-- UtterAccess.com NewsAccess Knowledge Center|-- Access Code Archive|-- Access Knowledgebase / FAQ|-- Access TutorialsMicrosoft® Access|-- Local Access User Groups (AUGs)|-- Interface Design|-- Access Q and A|-- Access Tables + Relationships|-- Access Queries|-- Access Forms|-- Access Reports|-- Access Macros|-- Access Modules|-- Access Date + Time|-- Access Errors + Error Handling|-- Access Built-in Functions|-- Access Searching + Data Mining|-- Access Records|-- Access Security|-- Access Automation|-- Access Database Container|-- Tool bars, Menu bars + Ribbon|-- Access Services (Web Databases)|-- Access Data Access Pages (Deprecated)|-- Access Data Projects - ADP|-- Access Runtime, Packaging & DeploymentAnd More...|-- Microsoft SQL Server|-- SQL Server Reporting Services|-- Microsoft SharePoint|-- Microsoft Internet Explorer|-- Visual Basic 6 and Earlier|-- Visual Basic 2003 and Later|-- ASP and VBScript|-- Web Development|-- PHP, Perl, MySQL and Postgres|-- Other Database Engines|-- BI Tools and Applications|-- JAVA and C#|-- GraphicsMicrosoft® Office|-- Microsoft Excel|-- Microsoft Excel FAQs|-- Microsoft Word|-- Microsoft Outlook|-- Microsoft PowerPoint|-- Microsoft FrontPage/Exp. Web|-- Other Microsoft ProductsPC|-- Network Issues|-- Q & A - Hardware|-- Q & A - Software|-- Q & A - Other PC|-- Virus + Security DiscussionUtterAccess Odds and Ends|-- General Chat|-- Q & A - UtterAccess.com Forums|-- Q & A - Access Wiki Options JeremyH2014View Member Profile Feb 24 2015, 01:19 PM Post#1Posts: 15Joined: 17-June 14Hello. I have built a fairly simple database in Access 2010 for the health and safety records of the company I work for and part of the system I have set up is that when a first aid incident is entered into the data inpu