|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Open report using Me.Filter?
I've created a form with a datasheet subform showing teacher contact data.
On the main form - I have multiple cmd Buttons that each have different filters (filters by course). They work great. Now how do I get filtered data to my report? Created new cmd button -- with one click: DoCmd.OpenReport "TeachersByCourseRpt", acViewPreview, , Me.Filter --------------- my filter buttons: With Me.TeachersbyCourseFrm.Form .Filter = "[Explor Tech] = -1" .FilterOn = True End With -------------- Shouldn't this work?!? It doesn't. I click a button, the filter applies perfectly, I click my preview report button -- but it shows all records not just the filtered ones on the report. Oh, I should mention that the subform is based on a query. Report is based on that same query. Thanks again. |
|
#2
|
|||
|
|||
|
Pass the filter and/or recordsource to the report in the Where Clause and OpenArgs arguments of DoCmd.OpenReport and then extract that info in the report's Open event. Example:
DoCmd.OpenReport "SampleList", IIf(booView = True, acViewPreview, acViewNormal), , Me.Filter, , Me.RecordSource Code:
Private Sub Report_Open(Cancel As Integer) Me.RecordSource = Nz(Me.OpenArgs, Me.RecordSource) End Sub |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > Open report using Me.Filter? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|