Button to open Reports

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Bonnie (Hambrick_at_discussions.microsoft.com)
Date: 07/07/04


Date: Wed, 7 Jul 2004 11:33:10 -0700

Hi there! Using A02 on XP. Have queried records meeting
criteria for Reminder1 reports. Each belongs to a pricing
structure SA02, SA03 or SA04. May be 23 of one, 5 of
another or even zero. Reminder1 has a report for each
pricing structure (old story). Each report's OnNoData
event shows a message and the report doesn't open if there
are no records for that reminder.

My form has a button (see code below). Problem is this: if
the first or second report has zero records, you get the
nice little message about NoData but as soon as you click
Okay, you get the OpenReportActionCancelled goodie and
even if the next report in line has data, you are out of
luck. How can I put something like the OnNoData code in my
button's OnClick event so it will move to the next report?

Luv U Guys, 1 N All. Always been a great help to me.
Thanks in advance for any help or advice.

Private Sub Rem1_Click()
    If CurrentUser() <> "BWA" And CurrentUser() <> "PLG"
And CurrentUser() <> "VRS" Then
    MsgBox "You are not authorized to open these reports."
      DoCmd.Close
    Else
On Error GoTo Err_Rem1_Click

    Dim stDocName As String

    stDocName = "RPSAdminFeeBillReminder1SA02"
    DoCmd.OpenReport stDocName, acPreview
    DoCmd.RunCommand acCmdZoom75
    
    stDocName = "RPSAdminFeeBillReminder1SA03"
    DoCmd.OpenReport stDocName, acPreview
    DoCmd.RunCommand acCmdZoom75

    stDocName = "RPSAdminFeeBillReminder1SA04"
    DoCmd.OpenReport stDocName, acPreview
    DoCmd.RunCommand acCmdZoom75

Exit_Rem1_Click:
    Exit Sub

Err_Rem1_Click:
    MsgBox Err.Description
    Resume Exit_Rem1_Click
    End If
End Sub



Relevant Pages

  • Re: Button to open Reports
    ... >criteria for Reminder1 reports. ... Reminder1 has a report for each ... >Private Sub Rem1_Click ... > DoCmd.OpenReport stDocName, acPreview ...
    (microsoft.public.access.formscoding)
  • RE: Help!! I having problems with Null Values!
    ... like any number X divided by zero is undefined in mathematics. ... Having separate fields for each month is not good database design. ... This is known as a multi-valued field design. ... This is the first time I am using the report feature. ...
    (microsoft.public.access.gettingstarted)
  • Re: No Records in Reports
    ... "Me" is the reference to the object ... >> want a 0 if there are no records in the subreport. ... >>>If you have No records in a Sub-Report how do you get the report to read ... >>>Zero in the amount field? ...
    (microsoft.public.access.gettingstarted)
  • Re: #NUM!
    ... Allen Browne - Microsoft MVP. ... I should have explained that I have other text boxes producing the desired results, the OT category is zero. ... I would like the text box to display a 0, as the others for OT on that line of the report display. ... You have the text box in the Page Footer, instead of the Report Footer. ...
    (microsoft.public.access.reports)
  • Re: Recording the frequency of Yes/No Fields
    ... Create a query. ... That will eliminate all the records where the number as zero. ... Or you can put a text box on the report if you wish. ... Tips for Access users - http://allenbrowne.com/tips.html ...
    (microsoft.public.access.tablesdbdesign)