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
|
|||
|
|||
Report with no data?
good day all...
I have a report (rptpaymenthistory) that I run from my invoincing form. The report has a main report and subreport that pulls data from a tlbinvoicepayments. Currently if I click my button to open the payment history report, the report opens even if there is no data from the tblinvoicepayments, is there a way that I can have it set up so that a message box will pop up if there have been no payments made / no data to report? Any ideas? suggestions? Brook |
#2
|
|||
|
|||
Report with no data?
On Fri, 2 Dec 2005 15:52:03 -0800, Brook wrote:
good day all... I have a report (rptpaymenthistory) that I run from my invoincing form. The report has a main report and subreport that pulls data from a tlbinvoicepayments. Currently if I click my button to open the payment history report, the report opens even if there is no data from the tblinvoicepayments, is there a way that I can have it set up so that a message box will pop up if there have been no payments made / no data to report? Any ideas? suggestions? Brook Code the Report's OnNoData event: MsgBox "Nothing going on today." Cancel = True This will generate error 2501 which you can trap in the event that you used to open the report. On Error Goto Err_Handler DoCmd.OpenReport "ReportName", acViewPreview Exit_Sub: Exit Sub Err_Handler: If Err = 2501 Then Else MsgBox "Error #: " & Err & " " & Err.Description End If Resume Exit_Sub -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
#3
|
|||
|
|||
Report with no data?
hello fred...
thanks for the response... I tried exactly what you posted but the report is still opening... i'm not getting a message box... Do I need to place any code in the subreport OnNoData event? Thanks, Brook "fredg" wrote: On Fri, 2 Dec 2005 15:52:03 -0800, Brook wrote: good day all... I have a report (rptpaymenthistory) that I run from my invoincing form. The report has a main report and subreport that pulls data from a tlbinvoicepayments. Currently if I click my button to open the payment history report, the report opens even if there is no data from the tblinvoicepayments, is there a way that I can have it set up so that a message box will pop up if there have been no payments made / no data to report? Any ideas? suggestions? Brook Code the Report's OnNoData event: MsgBox "Nothing going on today." Cancel = True This will generate error 2501 which you can trap in the event that you used to open the report. On Error Goto Err_Handler DoCmd.OpenReport "ReportName", acViewPreview Exit_Sub: Exit Sub Err_Handler: If Err = 2501 Then Else MsgBox "Error #: " & Err & " " & Err.Description End If Resume Exit_Sub -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
#4
|
|||
|
|||
Report with no data?
i'm not sure if this helps, but here is my code that I currently have for
opening my report... --- begin code --- Private Sub cmdpaymenthistory_Click() Dim strReportName As String Dim strcriteria As String If NewRecord Then MsgBox "This record contains no data. Please select a record to print or Save this record." _ , vbInformation, "Invalid Action" Exit Sub Else strReportName = "rptpaymenthistory" strcriteria = "[invoiceid]= " & Me![invoiceid] DoCmd.OpenReport strReportName, acViewPreview, , strcriteria If MsgBox("Do you want to save the report to disk?", vbYesNo + vbQuestion, "Save Report") = vbYes Then strOutputName = "D:\Karma Imports\Invoices\" & (Me!invoicenumber) & "Payment History" & " - " & Format(Me!invoicedate, "mmddyyyy") & " - " & Format(Date, "mmddyyyy") & ".snp" DoCmd.OutputTo acOutputReport, strReportName, acFormatSNP, strOutputName, True End If End If End Sub End Code --- Brook "fredg" wrote: On Fri, 2 Dec 2005 15:52:03 -0800, Brook wrote: good day all... I have a report (rptpaymenthistory) that I run from my invoincing form. The report has a main report and subreport that pulls data from a tlbinvoicepayments. Currently if I click my button to open the payment history report, the report opens even if there is no data from the tblinvoicepayments, is there a way that I can have it set up so that a message box will pop up if there have been no payments made / no data to report? Any ideas? suggestions? Brook Code the Report's OnNoData event: MsgBox "Nothing going on today." Cancel = True This will generate error 2501 which you can trap in the event that you used to open the report. On Error Goto Err_Handler DoCmd.OpenReport "ReportName", acViewPreview Exit_Sub: Exit Sub Err_Handler: If Err = 2501 Then Else MsgBox "Error #: " & Err & " " & Err.Description End If Resume Exit_Sub -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
sorting data in a report | David | Setting Up & Running Reports | 21 | October 14th, 2005 03:05 PM |
Has anyone seen this behaviour? What might it be? | tw | General Discussion | 4 | June 30th, 2005 03:23 PM |
To Sharkbyte and all: Calculate a total values in group level | Ally | General Discussion | 6 | June 13th, 2005 08:16 PM |
Format on data to import to Access tables? (I need your advice) | Niklas Östergren | General Discussion | 5 | December 13th, 2004 02:54 PM |
Help!! I'm running around in circles! | CathyA | New Users | 19 | December 12th, 2004 07:50 PM |