Rabu, 23 Mei 2012

RE: [MS_AccessPros] Re: Run-time error '2501' OpenReport Action was canceled

Agreed ... but he had a msgbox in the No Data AND the Error Handler. So all else aside, there were going to be 2 alerts to the user.











________________________________
> To: MS_Access_Professionals@yahoogroups.com
> From: wrmosca@comcast.net
> Date: Wed, 23 May 2012 13:58:42 +0000
> Subject: [MS_AccessPros] Re: Run-time error '2501' OpenReport Action
> was canceled
>
>
>
> Steve
>
> This entire thread must have confused the socks off of Calvin. Finding
> out that his editor was set to break on all errors didn't help matters
> any.
>
> I use the Cancel=-1 in most of my reports to the extent that my generic
> error handle looks like this.
>
> Private Sub cmdOpenRpt_Click()
> On Error GoTo err_PROC
>
> DoCmd.OpenReport "MyReport", acViewPreview
>
> exit_PROC:
> On Error Resume Next
> Exit Sub
>
> err_PROC:
> Dim strErrMsg As String
> Dim lngErrIconBtn As Long
>
> Select Case Err.Number
> Case 2501
> strErrMsg = "No data for selected filter."
> Case Else
> strErrMsg = "Error " & Err.Number & " (" & Err.Description & ") " _
> & "occurred in procedure cmdOpenRpt_Click of " _
> & "VBA Document Module1"
> lngErrIconBtn = vbOKOnly + vbInformation
>
> MsgBox strErrMsg, lngErrIconBtn, "Error"
>
> End Select
>
> Resume exit_PROC
>
> End Sub
>
> Bill
>
> --- In
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com>,
> Steve Conklin <StephenMConklin@...> wrote:
>>
>>
>> Thomas, not to belabor the point, but I apologize as I think the most
> important point is being missed through all this ...
>>
>>
>>
>> the take-away is when you say "cancel=true" that is when the error is
> raised. the line "cancel=true" might just as well be
>>
>>
>>
>> "err.raise 2501".
>>
>>
>>
>> so, msgboxs before cancel dont "count" as error handling. if it were
> my app, i wouldnt say anything to the user in the report's no_data.
>>
>>
>>
>> the report's no data would just have the cancel=true line. then, at
> that point, i would have my form handle error 2501 (which is what
> cancel=true raised) with a msgbox, "no data for that selection".
>>
>>
>>
>> I hope that clarifies.
>>
>>
>>
>>
>>
>> Steve
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> ________________________________
>>> To:
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com>
>>> From: thomas_lam_us@...
>>> Date: Tue, 22 May 2012 21:20:24 +0000
>>> Subject: [MS_AccessPros] Re: Run-time error '2501' OpenReport Action
>>> was canceled
>>>
>>>
>>>
>>> Steve,
>>>
>>> Any reasons why the Msgbox can't be run in the error processing? How do
>>> you communicate with the user on the specific error code when the
>>> Cancel is in effect?
>>>
>>> Thomas
>>>
>>> --- In
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>,
>>> Steve Conklin <StephenMConklin@> wrote:
>>>>
>>>>
>>>> FOR THE 3rd TIME:
>>>>
>>>>
>>>>
>>>> Select Case Err.Number
>>>> Case 2501
>>>> 'Report has no data and is cancelled.
>>>> strErrMsg = "No data available for the report."
>>>> Case Else
>>>> 'All other errors.
>>>> strErrMsg = "Error " & Err.Number & " (" & Err.Description & ") " _
>>>> & "occurred in procedure cmdOpenReport_Click Event"
>>>> End Select
>>>>
>>>> lngErrIconBtn = vbOKOnly + vbInformation
>>>>
>>>>
>>>>
>>>>
>>>> ******
>>>>
>>>> DONT RUN THIS LINE HERE:
>>>>
>>>>
>>>> MsgBox strErrMsg, lngErrIconBtn
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ***********
>>>>
>>>>
>>>>
>>>>
>>>> Exit_Command20_Click:
>>>> Exit Sub
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ________________________________
>>>>> To:
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>> From: thomas_lam_us@
>>>>> Date: Tue, 22 May 2012 20:49:23 +0000
>>>>> Subject: [MS_AccessPros] Re: Run-time error '2501' OpenReport Action
>>>>> was canceled
>>>>>
>>>>>
>>>>>
>>>>> OK. I follow exactly what you told me to do. Put a halt and then step
>>>>> through the execution.
>>>>>
>>>>> Right after the Docmd.RunMacro, the Docmd.Openreport brings me to the
>>>>> No Data event where the CANCEL = TRUE is executed. Then on it's
> way out
>>>>> to the Docmd.OpenReport command, 2501 error prompt appears. The
> CANCEL
>>>>> doesn't seem to have an impact in the NoData event at all.
>>>>>
>>>>> Thomas
>>>>>
>>>>> --- In
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>,
>>>>> John Viescas <JohnV@> wrote:
>>>>>>
>>>>>> Thomas-
>>>>>>
>>>>>>
>>>>>>
>>>>>> That should work. You should get your "No data available for the
>>> report"
>>>>>> message. If that's not what's happening, put a halt on the
> stDocName
>>>>> assignment
>>>>>> statement, then single step through the code when it stops.
>>>>>>
>>>>>>
>>>>>>
>>>>>> John Viescas, author
>>>>>>
>>>>>> Microsoft Office Access 2010 Inside Out
>>>>>>
>>>>>> Microsoft Office Access 2007 Inside Out
>>>>>>
>>>>>> Building Microsoft Access Applications
>>>>>>
>>>>>> Microsoft Office Access 2003 Inside Out
>>>>>>
>>>>>> SQL Queries for Mere Mortals
>>>>>>
>>>>>> <http://www.viescas.com/> http://www.viescas.com/
>>>>>>
>>>>>> (Paris, France)
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> From:
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>
>>>>>
>>>
> [mailto:MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>]
>>>>> On Behalf Of Thomas
>>>>>> Sent: Tuesday, May 22, 2012 10:19 PM
>>>>>> To:
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> Subject: [MS_AccessPros] Re: Run-time error '2501' OpenReport
>>> Action was
>>>>>> canceled
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Here is my latest code.
>>>>>>
>>>>>> Private Sub Command20_Click()
>>>>>>
>>>>>> On Error GoTo Err_Command20_Click
>>>>>>
>>>>>> Dim stDocName As String
>>>>>>
>>>>>> stDocName = "select codes and dst cntrs"
>>>>>> DoCmd.RunMacro stDocName
>>>>>>
>>>>>> DoCmd.OpenReport "Vendor Report TY VS LY", acViewPreview
>>>>>> GoTo Exit_Command20_Click
>>>>>>
>>>>>> Err_Command20_Click:
>>>>>>
>>>>>> err_Command20_PROC:
>>>>>> Dim strErrMsg As String
>>>>>> Dim lngErrIconBtn As Long
>>>>>>
>>>>>> Select Case Err.Number
>>>>>> Case 2501
>>>>>> 'Report has no data and is cancelled.
>>>>>> strErrMsg = "No data available for the report."
>>>>>> Case Else
>>>>>> 'All other errors.
>>>>>> strErrMsg = "Error " & Err.Number & " (" & Err.Description & ") " _
>>>>>> & "occurred in procedure cmdOpenReport_Click Event"
>>>>>> End Select
>>>>>>
>>>>>> lngErrIconBtn = vbOKOnly + vbInformation
>>>>>>
>>>>>> MsgBox strErrMsg, lngErrIconBtn
>>>>>>
>>>>>> Exit_Command20_Click:
>>>>>> Exit Sub
>>>>>>
>>>>>> 'Err_Command20_Click:
>>>>>> ' MsgBox Err.Description
>>>>>> ' Resume Exit_Command20_Click
>>>>>>
>>>>>> End Sub
>>>>>>
>>>>>> and the On No Data event
>>>>>>
>>>>>> Option Compare Database
>>>>>>
>>>>>> Private Sub Report_NoData(Cancel As Integer)
>>>>>> Cancel = True
>>>>>> End Sub
>>>>>>
>>>>>> --- In
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com> , John Viescas
>>> <JohnV@>
>>>>>> wrote:
>>>>>>>
>>>>>>> Thomas-
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Please post the code that opens the form as you have it now. The
>>>>> Cancel = True
>>>>>>> needs to be there to stop the form opening. Your OnError
> must still
>>>>> be in the
>>>>>>> wrong place.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> John Viescas, author
>>>>>>>
>>>>>>> Microsoft Office Access 2010 Inside Out
>>>>>>>
>>>>>>> Microsoft Office Access 2007 Inside Out
>>>>>>>
>>>>>>> Building Microsoft Access Applications
>>>>>>>
>>>>>>> Microsoft Office Access 2003 Inside Out
>>>>>>>
>>>>>>> SQL Queries for Mere Mortals
>>>>>>>
>>>>>>> <http://www.viescas.com/> http://www.viescas.com/
>>>>>>>
>>>>>>> (Paris, France)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> From:
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>
>>>>>
>>>
> [mailto:MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf Of
>>> Thomas
>>>>>>> Sent: Tuesday, May 22, 2012 9:46 PM
>>>>>>> To:
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> Subject: [MS_AccessPros] Re: Run-time error '2501' OpenReport
>>> Action was
>>>>>>> canceled
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> The macro contains a series of Openquery which creates the tables
>>>>> to be used
>>>>>> for
>>>>>>> the Report.
>>>>>>>
>>>>>>> As I have indicated, once I removed the CANCEL statement,
> the 2501
>>>>> disappear
>>>>>> but
>>>>>>> the blank report (with report title) shows up.
>>>>>>>
>>>>>>> Thomas
>>>>>>>
>>>>>>> --- In
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com> , John Viescas
>>>>> <JohnV@>
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Thomas-
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> The Cancel = True needs to be there. What is the macro
> doing? Is
>>>>> that also
>>>>>>>> opening a report?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> John Viescas, author
>>>>>>>>
>>>>>>>> Microsoft Office Access 2010 Inside Out
>>>>>>>>
>>>>>>>> Microsoft Office Access 2007 Inside Out
>>>>>>>>
>>>>>>>> Building Microsoft Access Applications
>>>>>>>>
>>>>>>>> Microsoft Office Access 2003 Inside Out
>>>>>>>>
>>>>>>>> SQL Queries for Mere Mortals
>>>>>>>>
>>>>>>>> <http://www.viescas.com/> http://www.viescas.com/
>>>>>>>>
>>>>>>>> (Paris, France)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> From:
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>
>>>>>
>>>
> [mailto:MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf
>>> Of Thomas
>>>>>>>> Sent: Tuesday, May 22, 2012 9:18 PM
>>>>>>>> To:
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> Subject: [MS_AccessPros] Re: Run-time error '2501' OpenReport
>>>>> Action was
>>>>>>>> canceled
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> John,
>>>>>>>>
>>>>>>>> It appears the CANCEL = True has no effect.
>>>>>>>>
>>>>>>>> Private Sub Report_NoData(Cancel As Integer)
>>>>>>>>>
>>>>>>>>>> 'MsgBox " There is no records to report.",
> vbExclamation, "No
>>>>> Records"
>>>>>>>>>
>>>>>>>>>> Cancel = True
>>>>>>>>>
>>>>>>>>>> 'Cancel = -1
>>>>>>>>>
>>>>>>>>>> End Sub
>>>>>>>>
>>>>>>>> When I comment out the CANCEL statement, the On error
> seems to be
>>>>> taking
>>>>>> it's
>>>>>>>> route properly. No more 2501 error message.
>>>>>>>>
>>>>>>>> Do you need to do something in order for the CANCEL statement
>>> to become
>>>>>>>> 'active'.
>>>>>>>>
>>>>>>>> Thomas
>>>>>>>>
>>>>>>>> --- In
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com> , John
> Viescas
>>>>> <JohnV@>
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> Thomas-
>>>>>>>>>
>>>>>>>>> Here's your original code:
>>>>>>>>>
>>>>>>>>> Private Sub Command20_Click()
>>>>>>>>>
>>>>>>>>> On Error GoTo Err_Command20_Click ' <===========
>>>>>>>>>
>>>>>>>>> Dim stDocName As String
>>>>>>>>>
>>>>>>>>> stDocName = "select codes and dst cntrs"
>>>>>>>>> DoCmd.RunMacro stDocName
>>>>>>>>>
>>>>>>>>> On Error GoTo err_Command20_PROC ' <=======
>>>>>>>>>
>>>>>>>>> DoCmd.OpenReport "Vendor Report TY VS LY", acViewPreview
>>>>>>>>>
>>>>>>>>> GoTo Exit_Command20_Click
>>>>>>>>>
>>>>>>>>> err_Command20_PROC:
>>>>>>>>> Dim strErrMsg As String
>>>>>>>>> Dim lngErrIconBtn As Long
>>>>>>>>>
>>>>>>>>> Select Case Err.Number
>>>>>>>>> Case 2501
>>>>>>>>>
>>>>>>>>> 'Report has no data and is cancelled.
>>>>>>>>>
>>>>>>>>> strErrMsg = "No data available for the report."
>>>>>>>>>
>>>>>>>>> Case Else
>>>>>>>>> 'All other errors.
>>>>>>>>> strErrMsg = "Error " & Err.Number & " (" & Err.Description
>>> & ") " _
>>>>>>>>> & "occurred in procedure cmdOpenReport_Click Event"
>>>>>>>>> End Select
>>>>>>>>>
>>>>>>>>> lngErrIconBtn = vbOKOnly + vbInformation
>>>>>>>>>
>>>>>>>>> MsgBox strErrMsg, lngErrIconBtn
>>>>>>>>>
>>>>>>>>> Exit_Command20_Click:
>>>>>>>>> Exit Sub
>>>>>>>>>
>>>>>>>>> Err_Command20_Click:
>>>>>>>>> MsgBox Err.Description
>>>>>>>>> Resume Exit_Command20_Click
>>>>>>>>>
>>>>>>>>> End Sub
>>>>>>>>>
>>>>>>>>> You need ONE OnError statement. What is the macro called
>>>>> "select codes and
>>>>>>> dst
>>>>>>>>> cntrs" doing? I suspect your code needs to look like:
>>>>>>>>>
>>>>>>>>> Private Sub Command20_Click()
>>>>>>>>>
>>>>>>>>> On Error GoTo Err_Command20_Click ' <= ONE error trap
>>>>>>>>>
>>>>>>>>> Dim stDocName As String
>>>>>>>>>
>>>>>>>>> stDocName = "select codes and dst cntrs"
>>>>>>>>> DoCmd.RunMacro stDocName
>>>>>>>>>
>>>>>>>>> DoCmd.OpenReport "Vendor Report TY VS LY", acViewPreview
>>>>>>>>>
>>>>>>>>> Exit_Command20_Click:
>>>>>>>>> Exit Sub
>>>>>>>>>
>>>>>>>>> err_Command20_PROC:
>>>>>>>>> Dim strErrMsg As String
>>>>>>>>> Dim lngErrIconBtn As Long
>>>>>>>>>
>>>>>>>>> Select Case Err.Number
>>>>>>>>> Case 2501
>>>>>>>>>
>>>>>>>>> 'Report has no data and is cancelled.
>>>>>>>>>
>>>>>>>>> strErrMsg = "No data available for the report."
>>>>>>>>>
>>>>>>>>> Case Else
>>>>>>>>> 'All other errors.
>>>>>>>>> strErrMsg = "Error " & Err.Number & " (" & Err.Description
>>> & ") " _
>>>>>>>>> & "occurred in procedure cmdOpenReport_Click Event"
>>>>>>>>> End Select
>>>>>>>>>
>>>>>>>>> lngErrIconBtn = vbOKOnly + vbInformation
>>>>>>>>>
>>>>>>>>> MsgBox strErrMsg, lngErrIconBtn
>>>>>>>>> Resume Exit_Command20_Click
>>>>>>>>>
>>>>>>>>> End Sub
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> John Viescas, author
>>>>>>>>> Microsoft Office Access 2010 Inside Out
>>>>>>>>> Microsoft Office Access 2007 Inside Out
>>>>>>>>> Building Microsoft Access Applications
>>>>>>>>> Microsoft Office Access 2003 Inside Out
>>>>>>>>> SQL Queries for Mere Mortals
>>>>>>>>> http://www.viescas.com/
>>>>>>>>> (Paris, France)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ---------------------------------
>>>>>>>>> From:
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>
>>>>>
>>>
> [mailto:MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com> ] On
> Behalf Of
>>>>> Thomas
>>>>>>>>> Sent: Tuesday, May 22, 2012 8:11 PM
>>>>>>>>> To:
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>> Subject: [MS_AccessPros] Re: Run-time error '2501' OpenReport
>>>>> Action was
>>>>>>>>> canceled
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Steve,
>>>>>>>>>
>>>>>>>>> Now after I remove both 'On error' statements, it is still
>>>>> giving me the
>>>>>>> 2501
>>>>>>>>> error on the Docmd.OpenReport statement.
>>>>>>>>>
>>>>>>>>> Thomas
>>>>>>>>>
>>>>>>>>> --- In
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com> ,
> Steve Conklin
>>>>>>>>> <StephenMConklin@> wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> This looks like one of those test questions where you
> have to
>>>>> figure out
>>>>>>>> which
>>>>>>>>> error handler is in effect. Please use only one handler per
>>>>> sub/function.
>>>>>>>> _PROC
>>>>>>>>> is in effect when the report generates err 2501. at then
>>> end of the
>>>>>> "select
>>>>>>>>> case" there is a msgbox before your exit statement . Steve
>>>>>>>>>> To:
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>> From: thomas_lam_us@
>>>>>>>>>> Date: Tue, 22 May 2012 17:48:18 +0000
>>>>>>>>>> Subject: Re: [MS_AccessPros] Run-time error '2501'
> OpenReport
>>>>> Action was
>>>>>>>>> canceled
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> OK. Here is the code that open the report
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Private Sub Command20_Click()
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Error GoTo Err_Command20_Click
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Dim stDocName As String
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> stDocName = "select codes and dst cntrs"
>>>>>>>>>>
>>>>>>>>>> DoCmd.RunMacro stDocName
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Error GoTo err_Command20_PROC
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> DoCmd.OpenReport "Vendor Report TY VS LY", acViewPreview
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> GoTo Exit_Command20_Click
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> err_Command20_PROC:
>>>>>>>>>>
>>>>>>>>>> Dim strErrMsg As String
>>>>>>>>>>
>>>>>>>>>> Dim lngErrIconBtn As Long
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Select Case Err.Number
>>>>>>>>>>
>>>>>>>>>> Case 2501
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> 'Report has no data and is cancelled.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> strErrMsg = "No data available for the report."
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Case Else
>>>>>>>>>>
>>>>>>>>>> 'All other errors.
>>>>>>>>>>
>>>>>>>>>> strErrMsg = "Error " & Err.Number & " (" &
>>> Err.Description & ") " _
>>>>>>>>>>
>>>>>>>>>> & "occurred in procedure cmdOpenReport_Click Event"
>>>>>>>>>>
>>>>>>>>>> End Select
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> lngErrIconBtn = vbOKOnly + vbInformation
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> MsgBox strErrMsg, lngErrIconBtn
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Exit_Command20_Click:
>>>>>>>>>>
>>>>>>>>>> Exit Sub
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Err_Command20_Click:
>>>>>>>>>>
>>>>>>>>>> MsgBox Err.Description
>>>>>>>>>>
>>>>>>>>>> Resume Exit_Command20_Click
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> End Sub
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --- In
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com> , John
> Viescas
>>>>> <JohnV@>
>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> Thomas-
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> That looks OK. What's critical is the code that opens the
>>>>> report. I
>>>>>> need
>>>>>>>> to
>>>>>>>>>>
>>>>>>>>>>> see that - the entire procedure.
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> John Viescas, author
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> Microsoft Office Access 2010 Inside Out
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> Microsoft Office Access 2007 Inside Out
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> Building Microsoft Access Applications
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> Microsoft Office Access 2003 Inside Out
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> SQL Queries for Mere Mortals
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> <http://www.viescas.com/> http://www.viescas.com/
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> (Paris, France)
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> From:
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>
>>>
> [mailto:MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com> ] On
> Behalf Of
>>>>> Thomas
>>>>>>>>>>
>>>>>>>>>>> Sent: Tuesday, May 22, 2012 7:20 PM
>>>>>>>>>>
>>>>>>>>>>> To:
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>> Subject: Re: [MS_AccessPros] Run-time error '2501'
>>>>> OpenReport Action
>>>>>> was
>>>>>>>>>>
>>>>>>>>>>> canceled
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> John,
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> This is what I have in the No Data Event on the report. I
>>>>> have tried
>>>>>> the
>>>>>>> 2
>>>>>>>>>>
>>>>>>>>>>> options and the 2501 error message still appears.
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> Private Sub Report_NoData(Cancel As Integer)
>>>>>>>>>>
>>>>>>>>>>> 'MsgBox " There is no records to report.", vbExclamation,
>>>>> "No Records"
>>>>>>>>>>
>>>>>>>>>>> Cancel = True
>>>>>>>>>>
>>>>>>>>>>> 'Cancel = -1
>>>>>>>>>>
>>>>>>>>>>> End Sub
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> Thomas
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> --- In
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com> ,
>>> John Viescas
>>>>>>> <JohnV@>
>>>>>>>>>>
>>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>> Thomas-
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>> You must have a No Data event procedure that's
>>> setting Cancel =
>>>>>> True.
>>>>>>> Is
>>>>>>>>> that
>>>>>>>>>>
>>>>>>>>>>>> the case?
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>> John Viescas, author
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>> Microsoft Office Access 2010 Inside Out
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>> Microsoft Office Access 2007 Inside Out
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>> Building Microsoft Access Applications
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>> Microsoft Office Access 2003 Inside Out
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>> SQL Queries for Mere Mortals
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>> <http://www.viescas.com/> http://www.viescas.com/
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>> (Paris, France)
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>> From:
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>
>>>
> [mailto:MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com> ] On
>>> Behalf Of
>>>>>> Thomas
>>>>>>>>>>
>>>>>>>>>>>> Sent: Tuesday, May 22, 2012 6:54 PM
>>>>>>>>>>
>>>>>>>>>>>> To:
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>>> Subject: Re: [MS_AccessPros] Run-time error '2501'
>>>>> OpenReport Action
>>>>>>> was
>>>>>>>>>>
>>>>>>>>>>>> canceled
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>> Hi John, Thanks for the quick response. Just want
> to make
>>>>> sure I
>>>>>> post
>>>>>>>> the
>>>>>>>>>>
>>>>>>>>>>>> correct information you requested. Wondering what
> do you
>>>>> want me to
>>>>>>> post
>>>>>>>>>>
>>>>>>>>>>>> regarding the report....?
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>> Thomas
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>> --- In
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>>>
> <mailto:MS_Access_Professionals%40yahoogroups.com> , John
>>>>> Viescas
>>>>>>>> <JohnV@>
>>>>>>>>>>
>>>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>> Thomas-
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>> Can you post the code from both the procedure that
>>> opens the
>>>>>> report
>>>>>>>> and
>>>>>>>>> the
>>>>>>>>>>
>>>>>>>>>>>>> report itself?
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>> John Viescas, author
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>> Microsoft Office Access 2010 Inside Out
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>> Microsoft Office Access 2007 Inside Out
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>> Building Microsoft Access Applications
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>> Microsoft Office Access 2003 Inside Out
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>> SQL Queries for Mere Mortals
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>> <http://www.viescas.com/> http://www.viescas.com/
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>> (Paris, France)
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>> From:
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>
>>>
> [mailto:MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com> ] On
>>>>> Behalf Of
>>>>>>> Thomas
>>>>>>>>>>
>>>>>>>>>>>>> Sent: Tuesday, May 22, 2012 6:05 PM
>>>>>>>>>>
>>>>>>>>>>>>> To:
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>>>> Subject: Re: [MS_AccessPros] Run-time error '2501'
>>> OpenReport
>>>>>> Action
>>>>>>>> was
>>>>>>>>>>
>>>>>>>>>>>>> canceled
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>> Hi Clive and Steve,
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>> I did have the codes in place but the error message
>>>>> still appears.
>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>> I check my Error checking and the 'enable error
>>> checking' is
>>>>>>> checked.
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>> What else could I be missing?
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>> Thomas
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>> --- In
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>> , "Clive"
>>>>>>> <zctek@>
>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>> Hi Thomas,
>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>> to add to what Steve suggested, it would be a good
>>>>>>>>>>
>>>>>>>>>>>>>> idea to use a MsgBox("Nothing to report") after the
>>>>>>>>>>
>>>>>>>>>>>>>> ' do nothing line, so the user knows what's
> happening.
>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>> Regards, Clive.
>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>> --- In
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com> ,
>>>>> Steve Conklin
>>>>>>>>>>
>>>>>>>>>>>>> <StephenMConklin@> wrote:
>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>>> Add a catch for err #2501:
>>>>>>>>>>
>>>>>>>>>>>>>>> On Error Goto err_Processing
>>>>>>>>>>
>>>>>>>>>>>>>>> Docmd.OpenReport "Report ABC", acViewPreview
>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>>> err_processing:
>>>>>>>>>>
>>>>>>>>>>>>>>> select case err
>>>>>>>>>>
>>>>>>>>>>>>>>> case 0, 2501
>>>>>>>>>>
>>>>>>>>>>>>>>> ' do nothing
>>>>>>>>>>
>>>>>>>>>>>>>>> case else
>>>>>>>>>>
>>>>>>>>>>>>>>> msgbox err.description
>>>>>>>>>>
>>>>>>>>>>>>>>> end select
>>>>>>>>>>
>>>>>>>>>>>>>>> hth
>>>>>>>>>>
>>>>>>>>>>>>>>> Steve
>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>>> ________________________________
>>>>>>>>>>
>>>>>>>>>>>>>>>> To:
>>>>>
>>>
> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com><mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>>>> <mailto:MS_Access_Professionals%40yahoogroups.com>
>>>>>>>>>>
>>>>>>>>>>>>>>>> From: thomas_lam_us@
>>>>>>>>>>
>>>>>>>>>>>>>>>> Date: Mon, 21 May 2012 22:39:02 +0000
>>>>>>>>>>
>>>>>>>>>>>>>>>> Subject: [MS_AccessPros] Run-time error '2501'
>>>>> OpenReport
>>>>>>> Action
>>>>>>>>> was
>>>>>>>>>>
>>>>>>>>>>>>> canceled
>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>>>> Here is what I already did but still failed
>>> with the
>>>>>> run-time
>>>>>>>>> error
>>>>>>>>>>
>>>>>>>>>>>>>>>> message. Appreciate if you can point out
> where I
>>>>> might have
>>>>>>> made
>>>>>>>>> the
>>>>>>>>>>
>>>>>>>>>>>>>>>> mistakes.
>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>>>> In my main line processing:
>>>>>>>>>>
>>>>>>>>>>>>>>>> On Error Goto err_Processing
>>>>>>>>>>
>>>>>>>>>>>>>>>> Docmd.OpenReport "Report ABC", acViewPreview
>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>>>> For Report ABC
>>>>>>>>>>
>>>>>>>>>>>>>>>> On No Data property
>>>>>>>>>>
>>>>>>>>>>>>>>>> Cancel = True
>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>>>> Thanks,
>>>>>>>>>>
>>>>>>>>>>>>>>>> Thomas
>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>> [Non-text portions of this message have been removed]
>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>> [Non-text portions of this message have been removed]
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> [Non-text portions of this message have been removed]
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> [Non-text portions of this message have been removed]
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> [Non-text portions of this message have been removed]
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> [Non-text portions of this message have been removed]
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> [Non-text portions of this message have been removed]
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>>
>>
>
>
>

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/MS_Access_Professionals/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/MS_Access_Professionals/join
(Yahoo! ID required)

<*> To change settings via email:
MS_Access_Professionals-digest@yahoogroups.com
MS_Access_Professionals-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
MS_Access_Professionals-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/

Tidak ada komentar:

Posting Komentar