Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Multiple Reports issue

Status
Not open for further replies.

huv123

Technical User
Sep 10, 2005
79
AU
ve have seen a number of threads on this but I cant seem to get my button going.

Basically the structure of my forms/database is that there is a switchboard on which there are two buttons, ones to a form called "Data Entry View" each of which has a button for each form that when clicked opens a pop up f(filter) orm where a person can enter a number which will filter the form for me when a button is clicked on this filter form.

THe other button on the switchboard is a "Report View" that opens an identical form (to Data Entry View) only in this case the filter form causes filtering of a report (there is one report for every form) not a form.

So farthis system works very well with me. However I want to include a single button on the "Report View" form that will allow me to print off all the available (6) reports for a particular ID.

I thought I could extend the code that I used for the Filter report form but it didnt work.

When I set a single button on form to use the entry in a text box on that fomr to OPEN and filter (multiple) reports it works fine - as so:

Code:
 Private Sub btnSearch_Click()

If DCount("ParticipantID", "tblParticipantDetails", _
"ParticipantID = Forms!frmPrintAllReports!txtSearch") > 0 Then

DoCmd.OpenReport "rptAthensQuestionnaire", acPreviewl, , _
"ParticipantID = Forms!frmPrintAllReports!txtSearch"

DoCmd.OpenReport "rptEdinburghQuestionnaire", acPreview, , _
"ParticipantID = Forms!frmPrintAllReports!txtSearch"
       
        DoCmd.Close acForm, "frmPrintAllReports"

  Else
    MsgBox "No records found - Please check your Participant ID  "

  End If
  
End Sub


If I use this code to filter and PRINT a SINGLE report it also works fine (although the docmd.close PrintAllReports form does not work).

Code:
 Private Sub btnSearch_Click()

If DCount("ParticipantID", "tblParticipantDetails", _
"ParticipantID = Forms!frmPrintAllReports!txtSearch") > 0 Then

DoCmd.OpenReport "rptAthensQuestionnaire", acViewNormal, , _
"ParticipantID = Forms!frmPrintAllReports!txtSearch"
     
        DoCmd.Close acForm, "frmPrintAllReports"

  Else
    MsgBox "No records found - Please check your Participant ID  "

  End If
  
End Sub

When I try to use this code to filter and print SEVERAL DIFFERENT REPORTS using the user's entry into the text box it will only filter and print the FIRST report and does not print the other report(s) - I really have six I am just showing you the first 2.

Code:
 Private Sub btnSearch_Click()

If DCount("ParticipantID", "tblParticipantDetails", _
"ParticipantID = Forms!frmPrintAllReports!txtSearch") > 0 Then

DoCmd.OpenReport "rptAthensQuestionnaire", AcView, , _
"ParticipantID = Forms!frmPrintAllReports!txtSearch"

DoCmd.OpenReport "rptEdinburghQuestionnaire", AcView, , _
"ParticipantID = Forms!frmPrintAllReports!txtSearch"
       
DoCmd.Close acForm, "frmPrintAllReports"

  Else
    MsgBox "No records found - Please check your Participant ID  "

  End If
  
End Sub

I wouldnt have thought changing acPreview for acViewNormal would make sure a big difference. It an filter, open and print preview multiple reports, it just cant filter, "open", and print multiple reports.
 
I KNOW What the problem is now. Just not what to do!

I realised the difference between the dummy database and my database is that on the close report event I have the text:

Private Sub Report_Close()
Forms!frmReportView.Visible = True
End Sub


I have this so when the research assistant closes the report the main menu for viewing reports individually pops back up. However when I took this text away the print all reports form works fine.

Anyway to get around this? I have attached a picture that outlines the structure of my forms/reports and close/open/visible commands.
 
 http://www.filesend.net/download.php?f=8eea84503bd68407392f128c2590e8f7
This problem has been solved. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top