If 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 above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Cancel report with no record.
Hi. Can anyone tell me how to cancel report if there is no record? I don't like to see a report with error on record fields. Thank you for your time. |
#2
|
|||
|
|||
Cancel report with no record.
add the following event procedure to the report's module, as
Private Sub Report_NoData(Cancel As Integer) Cancel = True MsgBox "Request cancelled - no data available." End Sub hth "Stephen" wrote in message ... Hi. Can anyone tell me how to cancel report if there is no record? I don't like to see a report with error on record fields. Thank you for your time. |
#3
|
|||
|
|||
Cancel report with no record.
Also note that, if you're opening the report from a macro or VBA code, Error
2501 will be returned by the report to the procedure that opened the report. If you don't want to see the ACCESS warning "The previous action has been canceled.", you'll need to trap for this error and stop the error message from appearing. E.g., DoCmd.OpenReport "ReportName" If Err.Number 2501 And Err.Number 0 Then MsgBox "Error occurred" End If -- Ken Snell MS ACCESS MVP "tina" wrote in message ... add the following event procedure to the report's module, as Private Sub Report_NoData(Cancel As Integer) Cancel = True MsgBox "Request cancelled - no data available." End Sub hth "Stephen" wrote in message ... Hi. Can anyone tell me how to cancel report if there is no record? I don't like to see a report with error on record fields. Thank you for your time. |
#4
|
|||
|
|||
Cancel report with no record.
oops, forgot that not-so-minor point. thanks for picking up the slack, Ken!
"Ken Snell" wrote in message ... Also note that, if you're opening the report from a macro or VBA code, Error 2501 will be returned by the report to the procedure that opened the report. If you don't want to see the ACCESS warning "The previous action has been canceled.", you'll need to trap for this error and stop the error message from appearing. E.g., DoCmd.OpenReport "ReportName" If Err.Number 2501 And Err.Number 0 Then MsgBox "Error occurred" End If -- Ken Snell MS ACCESS MVP "tina" wrote in message ... add the following event procedure to the report's module, as Private Sub Report_NoData(Cancel As Integer) Cancel = True MsgBox "Request cancelled - no data available." End Sub hth "Stephen" wrote in message ... Hi. Can anyone tell me how to cancel report if there is no record? I don't like to see a report with error on record fields. Thank you for your time. |
#5
|
|||
|
|||
Cancel report with no record.
"tina" wrote in message
... oops, forgot that not-so-minor point. thanks for picking up the slack, Ken! :-) -- Ken Snell MS ACCESS MVP |
Thread Tools | |
Display Modes | |
|
|