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:
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).
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.
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.
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.