Denise2020
Member
- Local time
- Today, 13:17
- Joined
- Mar 31, 2020
- Messages
- 82
I am driving myself crazy with this. I have a form with various filters. One is a free-form textbox where you can type in a word or phrase and it will search most of the controls on the form, another is a button that selects all items that have a certain checkbox checked, and another is a dropdown list where certain pre-made lists can be chosen. I have a generic report and a button to open that report and would like to pass the filter criteria, whichever it may be, to the report. Basically, I want to print a list of whatever items I have filtered with the various filter methods on the report with one single button.
Nothing I have tried is working. I have tried various methods of either applying the filter to the report with the button on the form, as well as to the report itself in the On Open event, to no avail. It either gives me errors, or else it opens with all 8000 items and does not filter the results. I should note that the form is actually a subform on a main navigation form. An example of code I have tried in so many various ways:
Dim RptFilter as String
RptFilter = Me.Filter
DoCmd.OpenReport "rptAmmo", , , RptFilter
or
Dim RptFilter as String
RptFilter = Forms!fMainForm!fFix.Form.Filter
me.Filter = RptFilter
me.Filteron = True
or
Dim RptFilter as String
RptFilter = Forms!fMainForm!fFix.Form.Filter
If Len(RptFilter)>0 Then
DoCmd.OpenReport "rptAmmo", , , RptFilter
Else
DoCmd.OpenReport "rptAmmo"
End If
I am just grasping at straws now as I have tried so much it is blurry. I've been googling all day but am about to give up and therefore I am here. What am I doing wrong? (be gentle!
)
Nothing I have tried is working. I have tried various methods of either applying the filter to the report with the button on the form, as well as to the report itself in the On Open event, to no avail. It either gives me errors, or else it opens with all 8000 items and does not filter the results. I should note that the form is actually a subform on a main navigation form. An example of code I have tried in so many various ways:
Dim RptFilter as String
RptFilter = Me.Filter
DoCmd.OpenReport "rptAmmo", , , RptFilter
or
Dim RptFilter as String
RptFilter = Forms!fMainForm!fFix.Form.Filter
me.Filter = RptFilter
me.Filteron = True
or
Dim RptFilter as String
RptFilter = Forms!fMainForm!fFix.Form.Filter
If Len(RptFilter)>0 Then
DoCmd.OpenReport "rptAmmo", , , RptFilter
Else
DoCmd.OpenReport "rptAmmo"
End If
I am just grasping at straws now as I have tried so much it is blurry. I've been googling all day but am about to give up and therefore I am here. What am I doing wrong? (be gentle!
