A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Report with no data?



 
 
Thread Tools Display Modes
  #1  
Old December 2nd, 2005, 11:52 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default 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  
Old December 3rd, 2005, 01:07 AM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default 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  
Old December 3rd, 2005, 04:50 AM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default 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  
Old December 3rd, 2005, 04:54 AM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT +1. The time now is 03:19 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.