Ms Access 2007 Runtime Error 2501
Contents |
Search Community Links Social Groups Pictures & Albums Members List Calendar Search Forums Show Threads Show Posts Tag Search Advanced Search Find All Thanked Posts Go to Page... Page 1 of 2 ms access error 2501 the openform action was cancelled 1 2 > Thread Tools Rating: Display Modes 02-05-2007, 02:33 PM #1
Access Run Time Error 2501 Outputto Action Was Canceled
ShanVel ShanMug Join Date: Oct 2005 Location: Akron, OH, USA Posts: 51 Thanks: 0 Thanked 0 Times in 0
Access 2010 Error 2501
Posts Run-time error 2501; OpenReport action was cancelled Folks, Need your help. I searched the entire forum and found couple of postings on this, but none of them indicates if there is any fix for
Run Time Error 2501 The Save Action Was Canceled
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 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 run time error 2501 the runmacro action was canceled 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 view to set the report's record source 'and search item label's caption DoCmd.Echo False 'suppress the screen updates DoCmd.OpenReport "rptBlrSrchItem1", acViewDesign With Reports("rptBlrSrchItem1") .RecordSource = strSQL .Controls("strOptItem").ControlSource = Choose(optCriteria, "memPred", "memGuar", "memRiskLevel", "memLDs") End With DoCmd.Close , , acSaveYes 'Now show the search results to the user DoCmd.OpenReport "rptBlrSrchItem1", acViewPreview DoCmd.Echo True Exit_PreviewRprt: Exit Sub Err_Prev
here for a quick overview of the site Help Center Detailed answers to any questions you might run time error 2501 the runcommand action was canceled have Meta Discuss the workings and policies of this site About access runtime error 2501 outputto action was cancelled Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting runtime error 2501 the openreport action was cancelled ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 http://www.access-programmers.co.uk/forums/showthread.php?t=122481 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Run Time Error '2501' up vote 1 down vote favorite I'm having the Run Time Error '2501' on a Form. Does anyone have ideas of why this happens and how to fix it? The Report is called through http://stackoverflow.com/questions/4683163/run-time-error-2501 this code: Private Sub Command92_Click() DoCmd.SetWarnings Off ''# get current reqid and version number DoCmd.OpenQuery "NewReqVersion", acViewNormal Dim NewReqID As Integer Dim NewVerID As Integer NewReqID = Me.Text58 NewVerID = Me.Version + 1 [Forms]![UWReviewForm].[StatusID] = 99 On Error Resume Next **DoCmd.Save acForm, "UWReviewForm"** DoCmd.OpenForm "NewReqVersionForm", acNormal DoCmd.GoToRecord acDataForm, "NewReqVersionForm", acLast End Sub Private Sub StatusID_Change() Me.LastModifiedTimeStamp = Now() End Sub vba ms-access runtime-error share|improve this question edited Nov 12 '12 at 6:15 Cheran Shunmugavel 6,12211732 asked Jan 13 '11 at 17:32 user574629 6112 1 Get rid of "On Error Resume Next" - it should only rarely be used. What code runs on load or on open for NewReqVersionForm? –Fionnuala Jan 13 '11 at 19:45 In never use it outside and error handler. –David-W-Fenton Jan 15 '11 at 3:05 DoCmd.Save acForm saves the design of the form, not the data displayed in it, so it looks to me like that line is not doing anything useful at all. If
FORUMSFOR COMPUTER PROFESSIONALS Log In Come Join Us! Are you aComputer / IT professional?Join Tek-Tips Forums! Talk With Other Members Be Notified http://www.tek-tips.com/viewthread.cfm?qid=1453633 Of ResponsesTo Your Posts Keyword Search One-Click Access To YourFavorite Forums https://bytes.com/topic/access/answers/876472-run-time-error-2501-a Automated SignaturesOn Your Posts Best Of All, It's Free! Join Us! *Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting Guidelines Promoting, selling, recruiting, coursework and thesis posting is forbidden.Tek-Tips Posting Policies Jobs Jobs from Indeed What: error 2501 Where: jobs by Link To This Forum! Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.Just copy and paste the BBCode HTML Markdown MediaWiki reStructuredText code below into your site. Microsoft: Access Forms Forum at Tek-Tips HomeForumsProgrammersDBMS PackagesMicrosoft: Access Forms Forum Runtime Error 2501 on Cmd.Save thread702-1453633 Forum Search FAQs Links MVPs time error 2501 Runtime Error 2501 on Cmd.Save Runtime Error 2501 on Cmd.Save sheusz (TechnicalUser) (OP) 25 Feb 08 19:56 Hi All,I have a database that is run across a server that used to work fine. Recently I added the following code to one on the data entry forms;CODEPrivate Sub Form_BeforeUpdate(Cancel As Integer)'Provide the user with the option to save/undo'changes made to the record in the formIf MsgBox("Changes have been made to this record." _& vbCrLf & vbCrLf & "Do you want to save these changes?" _, vbYesNo, "Changes Made...") = vbYes ThenDoCmd.SaveElseDoCmd.RunCommand acCmdUndoEnd IfEnd SubThe form work fine if there is only one user accessing the database, but as soon another user uses the database, then tries to to save a record on the form I get the following error;Run-Time error '2501'The Save action was canceled.Checking the Debug Screen highlights the lineDoCmd.SaveIf I remove the above code everything works fine.We are using MS Access 2003.Does anybody have a clue as to what I an doing wrong here?Thanks in advance RE: Runtime
question and get tips & solutions from a community of 418,595 IT Pros & Developers. It's quick & easy. Run-time error 2501 P: 15 sassy2009 Hello, I am running an insert query from xl spreadsheet using the DoCmd.RunSQL to insert values from the spreadsheet into the Access database. When i run this query it gives an error saying " Run-time error 2501 RunSQL action was cancelled". I know why this is happening and it's because of the message box that appears when an action query is run in Access which asks for a confirmation from the user "yes" or "no" buttons. But when i run the query from Spreadsheet, Access assumes "no" for the message box and cancels the RunSQL. How do I handle this error. If I ran the same query in Access itself it gives me the same "2501" error when I clicked on the "NO" button. Please help..... Nov 3 '09 #1 Post Reply ✓ answered by topher23 Well, the reason the new code doesn't have the same issue is easy enough to be seen here. With the old code, you actually opened an instance of Access in order to enter your data, which triggered the confirmation dialog for the action query. In the new code, you are referencing your database as a data source without actually opening Access, thus bypassing any protections built into Access. Therefore, the new code doesn't trigger the confirmation dialog, since there is no instance of Access open for it to trigger from. @sassy2009 Well, strike that stuff about dialog boxes, I just found your answer. When you have an open Excel workbook in Office 2007, and the workbook opens an Access instance, it apparently opens the database as read-only! No one on any other forum had any suggestions of how to make it not do this. So, the code you found is the only code that will work in this case, as it doesn't actually open Access. Share this Question 7 Replies Expert 100+ P: 234 topher23 Your best bet is to turn off confirmation for