G
Guest
I have a form which lists studies. People can filter the form based on
details about the study, such as the study type. Currently users filter via
the right click method.
I would like to be able to have a report that shows just the filtered records.
The code that I tried which didn't work:
Private Sub print_detail_Click()
On Error GoTo Err_print_detail_Click
DoCmd.Minimize
Dim stDocName As String
stDocName = "RptStudyInformationDetail"
'Debug.Print Me.Filter
'Debug.Print Me.RecordSource
DoCmd.openreport stDocName, acViewPreview, , Me.Filter, , Me.RecordSource
Reports!RptStudyInformationDetail.FilterOn = True
Exit_print_detail_Click:
Exit Sub
Err_print_detail_Click:
MsgBox Err.Description
Resume Exit_print_detail_Click
End Sub
The Debug Window read the following for Me.Recordsource:
SELECT TblMainStudyInformation.* FROM TblMainStudyInformation INNER JOIN
[TblChoicesNames] ON TblMainStudyInformation.[Study Director] =
[TblChoicesNames].NameCode WHERE ((([last name] & ',' & [first initial] &
[middle initial])='Smith,JM'));
And the following for Me.Filter:
((([Lookup_Test System].[Test System]="SYSTEMTYPE1"))) AND
((Lookup_Sponsor.Initials="RWW"))
Anybody have any idea how to make this work?
Thanks,
Beth
details about the study, such as the study type. Currently users filter via
the right click method.
I would like to be able to have a report that shows just the filtered records.
The code that I tried which didn't work:
Private Sub print_detail_Click()
On Error GoTo Err_print_detail_Click
DoCmd.Minimize
Dim stDocName As String
stDocName = "RptStudyInformationDetail"
'Debug.Print Me.Filter
'Debug.Print Me.RecordSource
DoCmd.openreport stDocName, acViewPreview, , Me.Filter, , Me.RecordSource
Reports!RptStudyInformationDetail.FilterOn = True
Exit_print_detail_Click:
Exit Sub
Err_print_detail_Click:
MsgBox Err.Description
Resume Exit_print_detail_Click
End Sub
The Debug Window read the following for Me.Recordsource:
SELECT TblMainStudyInformation.* FROM TblMainStudyInformation INNER JOIN
[TblChoicesNames] ON TblMainStudyInformation.[Study Director] =
[TblChoicesNames].NameCode WHERE ((([last name] & ',' & [first initial] &
[middle initial])='Smith,JM'));
And the following for Me.Filter:
((([Lookup_Test System].[Test System]="SYSTEMTYPE1"))) AND
((Lookup_Sponsor.Initials="RWW"))
Anybody have any idea how to make this work?
Thanks,
Beth