![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a cmd button with this code * * On Error GoTo fExit * * DoCmd.OpenForm "frmImportShootSheet", acNormal, , , acFormEdit fExit: * * On Error Resume Next and the form's open event does * * *cancel = true * * *exit sub I'm expecting the error to be trapped at fExit but I get the standard ms-access popout about * *runtime error 2501 * *the openform action was cancelled I get the error event if I add this to the cmd button's form on error event * * On Error Resume Next * * If (DataErr = 2501) Then * * * * Response = acDataErrContinue * * End If what am I missing ? |
#3
| |||
| |||
|
|
On Oct 30, 1:37*pm, Roger <lesperan... (AT) natpro (DOT) com> wrote: I have a cmd button with this code * * On Error GoTo fExit * * DoCmd.OpenForm "frmImportShootSheet", acNormal, , , acFormEdit fExit: * * On Error Resume Next and the form's open event does * * *cancel = true * * *exit sub I'm expecting the error to be trapped at fExit but I get the standard ms-access popout about * *runtime error 2501 * *the openform action was cancelled I get the error event if I add this to the cmd button's form on error event * * On Error Resume Next * * If (DataErr = 2501) Then * * * * Response = acDataErrContinue * * End If what am I missing ? I think * If (Err.Number = 2501) then would work better. I'm not sure you really need the On Error Resume Next statement. *You call the open form and if it gets canceled it will return and then execture the On Error routine.- Hide quoted text - - Show quoted text - |
#4
| |||
| |||
|
|
On Oct 31, 9:01*am, Patrick Finucane <patrickfinucan... (AT) gmail (DOT) com wrote: On Oct 30, 1:37*pm, Roger <lesperan... (AT) natpro (DOT) com> wrote: I have a cmd button with this code * * On Error GoTo fExit * * DoCmd.OpenForm "frmImportShootSheet", acNormal, , , acFormEdit fExit: * * On Error Resume Next and the form's open event does * * *cancel = true * * *exit sub I'm expecting the error to be trapped at fExit but I get the standard ms-access popout about * *runtime error 2501 * *the openform action was cancelled I get the error event if I add this to the cmd button's form on error event * * On Error Resume Next * * If (DataErr = 2501) Then * * * * Response = acDataErrContinue * * End If what am I missing ? I think * If (Err.Number = 2501) then would work better. I'm not sure you really need the On Error Resume Next statement. *You call the open form and if it gets canceled it will return and then execture the On Error routine.- Hide quoted text - - Show quoted text - I agree but this doesn't work On Error GoTo fExit DoCmd.OpenForm "frmImportShootSheet", acNormal, , , acFormEdit exit sub fExit: stop I get the standard ms-access msgbox, click 'debug' and the docmd.openform line is highlighted if I step through the function into the form's open event where cancel is set, the 'exit sub' in the form's open event causes the same problem this doesn't happen with access2007, it works correctly |
#5
| |||
| |||
|
|
On 31/10/2011 19:10:24, Roger wrote: On Oct 31, 9:01*am, Patrick Finucane <patrickfinucan... (AT) gmail (DOT) com wrote: On Oct 30, 1:37*pm, Roger <lesperan... (AT) natpro (DOT) com> wrote: I have a cmd button with this code * * On Error GoTo fExit * * DoCmd.OpenForm "frmImportShootSheet", acNormal, , , acFormEdit fExit: * * On Error Resume Next and the form's open event does * * *cancel = true * * *exit sub I'm expecting the error to be trapped at fExit but I get the standard ms-access popout about * *runtime error 2501 * *the openform action was cancelled I get the error event if I add this to the cmd button's form on error event * * On Error Resume Next * * If (DataErr = 2501) Then * * * * Response = acDataErrContinue * * End If what am I missing ? I think * If (Err.Number = 2501) then would work better. I'm not sure you really need the On Error Resume Next statement. *You call the open form and if it gets canceled it will return and then execture the On Error routine.- Hide quoted text - - Show quoted text - I agree but this doesn't work On Error GoTo fExit DoCmd.OpenForm "frmImportShootSheet", acNormal, , , acFormEdit exit sub fExit: stop I get the standard ms-access msgbox, click 'debug' and the docmd.openform line is highlighted if I step through the function into the form's open event where cancel is set, the 'exit sub' in the form's open event causes the same problem this doesn't happen with access2007, it works correctly This is the tail end of an OpenReport routine on a Command button *DoCmd.OpenReport "RptEvents", acViewPreview, , _ "EventSelected Selected = True AND DDiff('d','" & Me.FromDate & "',Cstr(FromDate)) <=0" _ & " AND DDiff('d','" & DateAdd("d", 1, Me.ToDate) & "',Cstr(ToDate)) >=0" Exit_ReportOptions_Click: * * Exit Sub Err_ReportOptions_Click: * * If Err <> 2501 Then * * * * * * * * * * *' Report cancelled - No data * * * * MsgBox Err.Description * * End If * * Resume Exit_ReportOptions_Click End Sub and this is the bit on the report Private Sub Report_NoData(Cancel As Integer) MsgBox gBox "There are no events of the selected type in the date range", vbInformation * * DoCmd.CancelEvent End Sub Does that help? Access 2010 Phil- Hide quoted text - - Show quoted text - |
#6
| |||
| |||
|
|
On Oct 31, 5:13*pm, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote: On 31/10/2011 19:10:24, Roger wrote: On Oct 31, 9:01*am, Patrick Finucane <patrickfinucan... (AT) gmail (DOT) com wrote: On Oct 30, 1:37*pm, Roger <lesperan... (AT) natpro (DOT) com> wrote: I have a cmd button with this code * * On Error GoTo fExit * * DoCmd.OpenForm "frmImportShootSheet", acNormal, , , acFormEdit fExit: * * On Error Resume Next and the form's open event does * * *cancel = true * * *exit sub I'm expecting the error to be trapped at fExit but I get the standard ms-access popout about * *runtime error 2501 * *the openform action was cancelled I get the error event if I add this to the cmd button's form on error event * * On Error Resume Next * * If (DataErr = 2501) Then * * * * Response = acDataErrContinue * * End If what am I missing ? I think * If (Err.Number = 2501) then would work better. I'm not sure you really need the On Error Resume Next statement. *You call the open form and if it gets canceled it will return and then execture the On Error routine.- Hide quoted text - - Show quoted text - I agree but this doesn't work On Error GoTo fExit DoCmd.OpenForm "frmImportShootSheet", acNormal, , , acFormEdit exit sub fExit: stop I get the standard ms-access msgbox, click 'debug' and the docmd.openform line is highlighted if I step through the function into the form's open event where cancel is set, the 'exit sub' in the form's open event causes the same problem this doesn't happen with access2007, it works correctly This is the tail end of an OpenReport routine on a Command button *DoCmd.OpenReport "RptEvents", acViewPreview, , _ "EventSelected Selected = True AND DDiff('d','" & Me.FromDate & "',Cstr(FromDate)) <=0" _ & " AND DDiff('d','" & DateAdd("d", 1, Me.ToDate) & "',Cstr(ToDate)) >=0" Exit_ReportOptions_Click: * * Exit Sub Err_ReportOptions_Click: * * If Err <> 2501 Then * * * * * * * * * * *' Report cancelled - No data * * * * MsgBox Err.Description * * End If * * Resume Exit_ReportOptions_Click End Sub and this is the bit on the report Private Sub Report_NoData(Cancel As Integer) MsgBox gBox "There are no events of the selected type in the date range", vbInformation * * DoCmd.CancelEvent End Sub Does that help? Access 2010 Phil- Hide quoted text - - Show quoted text - I created a new accdb frmTest2 has no controls, and this open event code * *Private Sub Form_Open(Cancel As Integer) * * Cancel = True * *End Sub frmTest has a command button and the click event code * * On Error Resume Next * * DoCmd.OpenForm "frmTest2", acNormal, , , acFormEdit * * MsgBox Err.Description I expect to see a message from the message box with * *The OpenForm action was canceled. but I get a message box from access with run time error 2501 The OpenForm action was canceled. with 'end', 'debug', 'help' buttons, and if I click debug, the docmd.openform line is highlighted about vba says version 1619 * *retail 7.0.1619 * * forms3 14.0.6009.100 I'm going to confirm that all windows / office updates has been done- Hide quoted text - - Show quoted text - |
#7
| |||
| |||
|
|
On Nov 1, 5:51*am, Roger <lesperan... (AT) natpro (DOT) com> wrote: On Oct 31, 5:13*pm, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote: On 31/10/2011 19:10:24, Roger wrote: On Oct 31, 9:01*am, Patrick Finucane <patrickfinucan... (AT) gmail (DOT) com wrote: On Oct 30, 1:37*pm, Roger <lesperan... (AT) natpro (DOT) com> wrote: I have a cmd button with this code * * On Error GoTo fExit * * DoCmd.OpenForm "frmImportShootSheet", acNormal, , , acFormEdit fExit: * * On Error Resume Next and the form's open event does * * *cancel = true * * *exit sub I'm expecting the error to be trapped at fExit but I get the standard ms-access popout about * *runtime error 2501 * *the openform action was cancelled I get the error event if I add this to the cmd button's form on error event * * On Error Resume Next * * If (DataErr = 2501) Then * * * * Response = acDataErrContinue * * End If what am I missing ? I think * If (Err.Number = 2501) then would work better. I'm not sure you really need the On Error Resume Next statement. *You call the open form and if it gets canceled it will return and then execture the On Error routine.- Hide quoted text - - Show quoted text - I agree but this doesn't work On Error GoTo fExit DoCmd.OpenForm "frmImportShootSheet", acNormal, , , acFormEdit exit sub fExit: stop I get the standard ms-access msgbox, click 'debug' and the docmd.openform line is highlighted if I step through the function into the form's open event where cancel is set, the 'exit sub' in the form's open event causes the same problem this doesn't happen with access2007, it works correctly This is the tail end of an OpenReport routine on a Command button *DoCmd.OpenReport "RptEvents", acViewPreview, , _ "EventSelected Selected = True AND DDiff('d','" & Me.FromDate & "',Cstr(FromDate)) <=0" _ & " AND DDiff('d','" & DateAdd("d", 1, Me..ToDate) & "',Cstr(ToDate)) >=0" Exit_ReportOptions_Click: * * Exit Sub Err_ReportOptions_Click: * * If Err <> 2501 Then * * * * * * * * * * *' Report cancelled - No data * * * * MsgBox Err.Description * * End If * * Resume Exit_ReportOptions_Click End Sub and this is the bit on the report Private Sub Report_NoData(Cancel As Integer) MsgBox gBox "There are no events of the selected type in the date range", vbInformation * * DoCmd.CancelEvent End Sub Does that help? Access 2010 Phil- Hide quoted text - - Show quoted text - I created a new accdb frmTest2 has no controls, and this open event code * *Private Sub Form_Open(Cancel As Integer) * * Cancel = True * *End Sub frmTest has a command button and the click event code * * On Error Resume Next * * DoCmd.OpenForm "frmTest2", acNormal, , , acFormEdit * * MsgBox Err.Description I expect to see a message from the message box with * *The OpenForm action was canceled. but I get a message box from access with run time error 2501 The OpenForm action was canceled. with 'end', 'debug', 'help' buttons, and if I click debug, the docmd.openform line is highlighted about vba says version 1619 * *retail 7.0.1619 * * forms3 14.0.6009.100 I'm going to confirm that all windows / office updates has been done- Hide quoted text - - Show quoted text - I downloaded / applied office 2010 sp 1, and an Oct 2011 hot fix - neither resolves the problem I created an onError event in frmTest Private Sub Form_Error(DataErr As Integer, Response As Integer) Stop End Sub but that doesn't trap the error either now what ?- Hide quoted text - - Show quoted text - |
#8
| |||
| |||
|
|
On Nov 1, 3:48*pm, Roger <lesperan... (AT) natpro (DOT) com> wrote: On Nov 1, 5:51*am, Roger <lesperan... (AT) natpro (DOT) com> wrote: On Oct 31, 5:13*pm, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote: On 31/10/2011 19:10:24, Roger wrote: On Oct 31, 9:01*am, Patrick Finucane <patrickfinucan... (AT) gmail (DOT) com wrote: On Oct 30, 1:37*pm, Roger <lesperan... (AT) natpro (DOT) com> wrote: I have a cmd button with this code * * On Error GoTo fExit * * DoCmd.OpenForm "frmImportShootSheet", acNormal, , , acFo rmEdit fExit: * * On Error Resume Next and the form's open event does * * *cancel = true * * *exit sub I'm expecting the error to be trapped at fExit but I get the standard ms-access popout about * *runtime error 2501 * *the openform action was cancelled I get the error event if I add this to the cmd button's form on error event * * On Error Resume Next * * If (DataErr = 2501) Then * * * * Response = acDataErrContinue * * End If what am I missing ? I think * If (Err.Number = 2501) then would work better. I'm not sure you really need the On Error Resume Next statement. *You call the open form and if it gets canceled it will return and then execture the On Error routine.- Hide quoted text - - Show quoted text - I agree but this doesn't work On Error GoTo fExit DoCmd.OpenForm "frmImportShootSheet", acNormal, , , acFormEdit exit sub fExit: stop I get the standard ms-access msgbox, click 'debug' and the docmd.openform line is highlighted if I step through the function into the form's open event where can cel is set, the 'exit sub' in the form's open event causes the same problem this doesn't happen with access2007, it works correctly This is the tail end of an OpenReport routine on a Command button *DoCmd.OpenReport "RptEvents", acViewPreview, , _ "EventSelected Selected = True AND DDiff('d','" & Me.FromDate & "',Cstr(FromDate)) <=0" _ & " AND DDiff('d','" & DateAdd("d", 1, Me .ToDate) & "',Cstr(ToDate)) >=0" Exit_ReportOptions_Click: * * Exit Sub Err_ReportOptions_Click: * * If Err <> 2501 Then * * * * * * * * * * *' Report cancelled - No data * * * * MsgBox Err.Description * * End If * * Resume Exit_ReportOptions_Click End Sub and this is the bit on the report Private Sub Report_NoData(Cancel As Integer) MsgBox gBox "There are no events of the selected type in the date ran ge", vbInformation * * DoCmd.CancelEvent End Sub Does that help? Access 2010 Phil- Hide quoted text - - Show quoted text - I created a new accdb frmTest2 has no controls, and this open event code * *Private Sub Form_Open(Cancel As Integer) * * Cancel = True * *End Sub frmTest has a command button and the click event code * * On Error Resume Next * * DoCmd.OpenForm "frmTest2", acNormal, , , acFormEdit * * MsgBox Err.Description I expect to see a message from the message box with * *The OpenForm action was canceled. but I get a message box from access with run time error 2501 The OpenForm action was canceled. with 'end', 'debug', 'help' buttons, and if I click debug, the docmd.openform line is highlighted about vba says version 1619 * *retail 7.0.1619 * * forms3 14.0.6009.100 I'm going to confirm that all windows / office updates has been done- H ide quoted text - - Show quoted text - I downloaded / applied office 2010 sp 1, and an Oct 2011 hot fix - neither resolves the problem I created an onError event in frmTest Private Sub Form_Error(DataErr As Integer, Response As Integer) Stop End Sub but that doesn't trap the error either now what ?- Hide quoted text - - Show quoted text - on a system with access2007, I created frmTest with a command button with click-event Private Sub Command0_Click() On Error GoTo fErr DoCmd.OpenForm "frmtest2" Exit Sub fErr: Stop Exit Sub End Sub and I created frmTest2 with open-event Private Sub Form_Open(Cancel As Integer) Cancel = True End Sub with access2007, clicking the button puts me at the stop statement I copied the accdb to a system with access2010, clicked the button, get a microsoft visual basic msgbox run-time error '2501' the openform action was canceled end debug help click debug, and the docmd. line is highlighted looks like a vbe bug... but where do I find the fix |
#9
| |||
| |||
|
|
On 04/11/2011 12:10:04, Roger wrote: On Nov 1, 3:48 pm, Roger <lesperan... (AT) natpro (DOT) com> wrote: On Nov 1, 5:51 am, Roger <lesperan... (AT) natpro (DOT) com> wrote: On Oct 31, 5:13 pm, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote: On 31/10/2011 19:10:24, Roger wrote: On Oct 31, 9:01 am, Patrick Finucane <patrickfinucan... (AT) gmail (DOT) com wrote: On Oct 30, 1:37 pm, Roger <lesperan... (AT) natpro (DOT) com> wrote: I have a cmd button with this code On Error GoTo fExit DoCmd.OpenForm "frmImportShootSheet", acNormal, , , acFo rmEdit fExit: On Error Resume Next and the form's open event does cancel = true exit sub I'm expecting the error to be trapped at fExit but I get the standard ms-access popout about runtime error 2501 the openform action was cancelled I get the error event if I add this to the cmd button's form on error event On Error Resume Next If (DataErr = 2501) Then Response = acDataErrContinue End If what am I missing ? I think If (Err.Number = 2501) then would work better. I'm not sure you really need the On Error Resume Next statement.. You call the open form and if it gets canceled it will return and then execture the On Error routine.- Hide quoted text - - Show quoted text - I agree but this doesn't work On Error GoTo fExit DoCmd.OpenForm "frmImportShootSheet", acNormal, , , acFormEdit exit sub fExit: stop I get the standard ms-access msgbox, click 'debug' and the docmd.openform line is highlighted if I step through the function into the form's open event where can cel is set, the 'exit sub' in the form's open event causes the same problem this doesn't happen with access2007, it works correctly This is the tail end of an OpenReport routine on a Command button DoCmd.OpenReport "RptEvents", acViewPreview, , _ "EventSelected Selected = True AND DDiff('d','" & Me.FromDate & "',Cstr(FromDate)) <=0" _ & " AND DDiff('d','" & DateAdd("d", 1,Me .ToDate) & "',Cstr(ToDate)) >=0" Exit_ReportOptions_Click: Exit Sub Err_ReportOptions_Click: If Err <> 2501 Then ' Report cancelled - No data MsgBox Err.Description End If Resume Exit_ReportOptions_Click End Sub and this is the bit on the report Private Sub Report_NoData(Cancel As Integer) MsgBox gBox "There are no events of the selected type in the date ran ge", vbInformation DoCmd.CancelEvent End Sub Does that help? Access 2010 Phil- Hide quoted text - - Show quoted text - I created a new accdb frmTest2 has no controls, and this open event code Private Sub Form_Open(Cancel As Integer) Cancel = True End Sub frmTest has a command button and the click event code On Error Resume Next DoCmd.OpenForm "frmTest2", acNormal, , , acFormEdit MsgBox Err.Description I expect to see a message from the message box with The OpenForm action was canceled. but I get a message box from access with run time error 2501 The OpenForm action was canceled. with 'end', 'debug', 'help' buttons, and if I click debug, the docmd.openform line is highlighted about vba says version 1619 retail 7.0.1619 forms3 14.0.6009.100 I'm going to confirm that all windows / office updates has been done- H ide quoted text - - Show quoted text - I downloaded / applied office 2010 sp 1, and an Oct 2011 hot fix - neither resolves the problem I created an onError event in frmTest Private Sub Form_Error(DataErr As Integer, Response As Integer) Stop End Sub but that doesn't trap the error either now what ?- Hide quoted text - - Show quoted text - on a system with access2007, I created frmTest with a command button with click-event Private Sub Command0_Click() On Error GoTo fErr DoCmd.OpenForm "frmtest2" Exit Sub fErr: Stop Exit Sub End Sub and I created frmTest2 with open-event Private Sub Form_Open(Cancel As Integer) Cancel = True End Sub with access2007, clicking the button puts me at the stop statement I copied the accdb to a system with access2010, clicked the button, get a microsoft visual basic msgbox run-time error '2501' the openform action was canceled end debug help click debug, and the docmd. line is highlighted looks like a vbe bug... but where do I find the fix 2 Forms Form 1 Private Sub Form_Open(Cancel As Integer) * * DoCmd.CancelEvent End Sub Form 2 has a command button on it Private Sub Command0_Click() * * On Error GoTo Command0_Err * * DoCmd.OpenForm "Form1" * * *Exit Sub Command0_Err: * * If Err = 2501 Then * * * * Resume Next * * End If End Sub No error message Phil- Hide quoted text - - Show quoted text - |
#10
| |||
| |||
|
|
On Nov 1, 3:48*pm, Roger <lesperan... (AT) natpro (DOT) com> wrote: On Nov 1, 5:51*am, Roger <lesperan... (AT) natpro (DOT) com> wrote: On Oct 31, 5:13*pm, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote: On 31/10/2011 19:10:24, Roger wrote: On Oct 31, 9:01*am, Patrick Finucane <patrickfinucan... (AT) gmail (DOT) com wrote: On Oct 30, 1:37*pm, Roger <lesperan... (AT) natpro (DOT) com> wrote: I have a cmd button with this code * * On Error GoTo fExit * * DoCmd.OpenForm "frmImportShootSheet", acNormal, , , acFormEdit fExit: * * On Error Resume Next and the form's open event does * * *cancel = true * * *exit sub I'm expecting the error to be trapped at fExit but I get the standard ms-access popout about * *runtime error 2501 * *the openform action was cancelled I get the error event if I add this to the cmd button's form on error event * * On Error Resume Next * * If (DataErr = 2501) Then * * * * Response = acDataErrContinue * * End If what am I missing ? I think * If (Err.Number = 2501) then would work better. I'm not sure you really need the On Error Resume Next statement.*You call the open form and if it gets canceled it will return and then execture the On Error routine.- Hide quoted text - - Show quoted text - I agree but this doesn't work On Error GoTo fExit DoCmd.OpenForm "frmImportShootSheet", acNormal, , , acFormEdit exit sub fExit: stop I get the standard ms-access msgbox, click 'debug' and the docmd.openform line is highlighted if I step through the function into the form's open event where cancel is set, the 'exit sub' in the form's open event causes the same problem this doesn't happen with access2007, it works correctly This is the tail end of an OpenReport routine on a Command button *DoCmd.OpenReport "RptEvents", acViewPreview, , _ "EventSelected Selected = True AND DDiff('d','" & Me.FromDate & "',Cstr(FromDate)) <=0" _ & " AND DDiff('d','" & DateAdd("d", 1, Me.ToDate) & "',Cstr(ToDate)) >=0" Exit_ReportOptions_Click: * * Exit Sub Err_ReportOptions_Click: * * If Err <> 2501 Then * * * * * * * * * **' Report cancelled - No data * * * * MsgBox Err.Description * * End If * * Resume Exit_ReportOptions_Click End Sub and this is the bit on the report Private Sub Report_NoData(Cancel As Integer) MsgBox gBox "There are no events of the selected type in the date range", vbInformation * * DoCmd.CancelEvent End Sub Does that help? Access 2010 Phil- Hide quoted text - - Show quoted text - I created a new accdb frmTest2 has no controls, and this open event code * *Private Sub Form_Open(Cancel As Integer) * * Cancel = True * *End Sub frmTest has a command button and the click event code * * On Error Resume Next * * DoCmd.OpenForm "frmTest2", acNormal, , , acFormEdit * * MsgBox Err.Description I expect to see a message from the message box with * *The OpenForm action was canceled. but I get a message box from access with run time error 2501 The OpenForm action was canceled. with 'end', 'debug', 'help' buttons, and if I click debug, the docmd.openform line is highlighted about vba says version 1619 * *retail 7.0.1619 * * forms3 14.0.6009.100 I'm going to confirm that all windows / office updates has been done-Hide quoted text - - Show quoted text - I downloaded / applied office 2010 sp 1, and an Oct 2011 hot fix - neither resolves the problem I created an onError event in frmTest Private Sub Form_Error(DataErr As Integer, Response As Integer) Stop End Sub but that doesn't trap the error either now what ?- Hide quoted text - - Show quoted text - on a system with access2007, I created frmTest with a command button with click-event Private Sub Command0_Click() * * On Error GoTo fErr * * DoCmd.OpenForm "frmtest2" * * Exit Sub fErr: * * Stop * * Exit Sub End Sub and I created frmTest2 with open-event Private Sub Form_Open(Cancel As Integer) * * Cancel = True End Sub with access2007, clicking the button puts me at the stop statement I copied the accdb to a system with access2010, clicked the button, get a microsoft visual basic msgbox * *run-time error '2501' * *the openform action was canceled * *end debug help click debug, and the docmd. line is highlighted looks like a vbe bug... but where do I find the fix- Hide quoted text - - Show quoted text - |
![]() |
| Thread Tools | |
| Display Modes | |
| |