Error 2501 Access Openform
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you access error 2501 openform action cancelled might have Meta Discuss the workings and policies of this ms access error 2501 the openform action was cancelled site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers runtime error 2501 openform action was canceled or posting 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
Run Time Error 2501 The Openform Action Was Cancelled
of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up How to prevent “OpenForm action was cancelled” in legacy Access Code up vote 2 down vote favorite 1 I recently took over a VERY old Access database. This database has a TON of macros written access openform filter that the users utilize to help them navigate and enter data. Thus, ditching the code is not step #1 despite the fact that these macros were written in Access 97.... I've managed to get most of the code to work by removing deprecated function calls with new ones, but there are a couple of forms that still do not work correctly. If I can figure out how to resolve one I'm sure I can resolve the others. The main macro has a menu with several buttons. Whenever I click one button I get a "The OpenForm action was cancelled" error. The code for this button is as follows: Option Compare Database 'Use database order for string comparisons Private Sub Form_Open(Cancel As Integer) If IsLoaded("ServiceCircuit") Then Me![PropBtn].Visible = True Else Me![PropBtn].Visible = False End If End Sub Private Sub Form_Unload(Cancel As Integer) If IsLoaded("ServiceCircuit") Then Forms![ServiceCircuit].Visible = True Forms![ServiceCircuit]![CircuitPrefix].Requery Forms![ServiceCircuit]![CircuitPrefix] = Forms![Circuit]![CircuitPrefix] Forms![ServiceCircuit]![CircuitBase].Requery Forms![ServiceCircuit]![CircuitBase] = Forms![Circuit]![CircuitBase] 'Forms!ServiceCircuit.Refresh Exit Sub Else
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies access openform where condition of this site About Us Learn more about Stack Overflow the company
Access Openform Where Condition Multiple
Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges
Access Openform Macro
Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: http://stackoverflow.com/questions/14129796/how-to-prevent-openform-action-was-cancelled-in-legacy-access-code 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 this code: Private Sub Command92_Click() DoCmd.SetWarnings Off ''# get current reqid and version number DoCmd.OpenQuery "NewReqVersion", acViewNormal Dim NewReqID As Integer Dim http://stackoverflow.com/questions/4683163/run-time-error-2501 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 you want to save the change to the data in that form, use Forms!UWReviewForm.Dirty = False. –David-W-Fenton Jan 15 '11 at 3:06 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote The error 2501 can occur on calling
this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link http://www.dbforums.com/showthread.php?1691788-runtime-error-2501-openform-action-was-canceled above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 3 of 3 Thread: runtime error 2501 openform action was canceled Tweet Thread Tools Show Printable Version Subscribe to this Thread… Search Thread Advanced Search Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 04-10-13,17:59 #1 rumenrs View Profile View Forum error 2501 Posts Registered User Join Date Apr 2013 Posts 4 Unanswered: runtime error 2501 openform action was canceled Hi, How to fix that? runtime error 2501 openform action was canceled Code: Option Compare Database Option Explicit Private Sub Generate_Click() ' Declare variables Dim db As DAO.Database Dim qdf As DAO.QueryDef Dim varItem As Variant Dim strCriteria As String Dim strSQL As String ' Get the database openform action was and stored query Set db = CurrentDb() Set qdf = db.QueryDefs("q_produkti_print") ' Loop through the selected items in the list box and build a text string If Me!list_names.ItemsSelected.Count > 0 Then For Each varItem In Me!list_names.ItemsSelected strCriteria = strCriteria & "produkti_vav.ID = " & Chr(34) _ & Me!list_names.ItemData(varItem) & Chr(34) & "OR " Next varItem strCriteria = Left(strCriteria, Len(strCriteria) - 3) Else strCriteria = "produkti_vav.ID Like '*'" End If ' Build the new SQL statement incorporating the string strSQL = "SELECT * FROM produkti_vav " & _ "WHERE " & strCriteria & ";" ' Apply the new SQL statement to the query qdf.SQL = strSQL ' Open the query DoCmd.OpenForm "f_produkti_print" ' Empty the memory Set db = Nothing Set qdf = Nothing End Sub Reply With Quote 04-11-13,14:19 #2 tcace View Profile View Forum Posts Registered User Join Date Apr 2004 Location outside the rim Posts 1,011 This line: DoCmd.OpenForm "f_produkti_print" opens the form. The cancel occurs after this line. Either the user is canceling it, or there is something in the Open Event of the form that is setting Cancel = True. I would also look at the SQL string you are a