P
PJ
I found a great sample that I am currently using in a form. I have an
inventory listing shown as a data sheet in a subform on a main form. At
this time, the user chooses a location from a combo box on the form and
the code filters the subform resaults to only show the location in the
combo box. The code I found and am using is as follows:
Private Sub Combo0_AfterUpdate()
' Declare variables
Dim frm As Form
Dim strInput As Variant
Dim strFilter As String
' Store value selected in combo box by user
strInput = [Combo0]
' This is the line of code that refers to the subform from the main
form:
Set frm = Forms![testinvwithsub]![InvTbltestform].Form
' Build criteria string
strFilter = BuildCriteria("Building", dbText, strInput)
' Set Filter property to apply filter
frm.Filter = strFilter
' Set FilterOn property to show filtered records
frm.FilterOn = True
End Sub
What I would like to be able to do is be able to just print the
filtered resaults from a button. I already have a button that will
print all (all records from subform). Would it be easier to have the
combo box that displays queries that are broken down by location, then
have a button that prints the query that is picked from the combo box?
Or is there a way to only print out the filtered data as shown. Thanks
in advance, and thanks also to the poster that posted the original code.
inventory listing shown as a data sheet in a subform on a main form. At
this time, the user chooses a location from a combo box on the form and
the code filters the subform resaults to only show the location in the
combo box. The code I found and am using is as follows:
Private Sub Combo0_AfterUpdate()
' Declare variables
Dim frm As Form
Dim strInput As Variant
Dim strFilter As String
' Store value selected in combo box by user
strInput = [Combo0]
' This is the line of code that refers to the subform from the main
form:
Set frm = Forms![testinvwithsub]![InvTbltestform].Form
' Build criteria string
strFilter = BuildCriteria("Building", dbText, strInput)
' Set Filter property to apply filter
frm.Filter = strFilter
' Set FilterOn property to show filtered records
frm.FilterOn = True
End Sub
What I would like to be able to do is be able to just print the
filtered resaults from a button. I already have a button that will
print all (all records from subform). Would it be easier to have the
combo box that displays queries that are broken down by location, then
have a button that prints the query that is picked from the combo box?
Or is there a way to only print out the filtered data as shown. Thanks
in advance, and thanks also to the poster that posted the original code.