Ive 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:
Private Sub btnSearch_Click()
If DCount("ParticipantID", "tblParticipantDetails", _
"ParticipantID = Forms!frmOpenRpt!txtSearch") > 0 Then
DoCmd.OpenReport "rpt1", acPreview, , _
"ParticipantID = Forms!frmOpenRpt!txtSearch"
DoCmd.OpenReport "rpt2", acPreview, , _
"ParticipantID = Forms!frmOpenRpt!txtSearch"
DoCmd.OpenReport "rpt3", acPreview, , _
"ParticipantID = Forms!frmOpenRpt!txtSearch"
DoCmd.Close acForm, "frmOpenRpt"
Else
MsgBox "No records found - Please check your Participant ID "
End If
End Sub
...and so on...
Anyone have any ideas?
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:
Private Sub btnSearch_Click()
If DCount("ParticipantID", "tblParticipantDetails", _
"ParticipantID = Forms!frmOpenRpt!txtSearch") > 0 Then
DoCmd.OpenReport "rpt1", acPreview, , _
"ParticipantID = Forms!frmOpenRpt!txtSearch"
DoCmd.OpenReport "rpt2", acPreview, , _
"ParticipantID = Forms!frmOpenRpt!txtSearch"
DoCmd.OpenReport "rpt3", acPreview, , _
"ParticipantID = Forms!frmOpenRpt!txtSearch"
DoCmd.Close acForm, "frmOpenRpt"
Else
MsgBox "No records found - Please check your Participant ID "
End If
End Sub
...and so on...
Anyone have any ideas?