Hello - I have several fields on a main form (asfAddressAll) that filter records to a continuous subform (asfAddressAllSubform). I would like to send the filtered records on the subform to Excel. How can I accomplish this? The following is the code used on buttons in the main form for filtering. Thank you in advance.
Code:
Dim mySearch As String
mySearch = "Select * from asqAddressAll where 1=1 "
If Not IsNull(Me.cboxStreetFilter) Then
mySearch = mySearch & " and [Street Name] = '" & Me.cboxStreetFilter & "' "
End If
If Not IsNull(Me.cboxTownFilter) Then
mySearch = mySearch & " and Town = '" & Me.cboxTownFilter & "' "
End If
If Not IsNull(Me.cboxSectionFilter) Then
mySearch = mySearch & " and Section = '" & Me.cboxSectionFilter & "' "
End If
If Not IsNull(Me.cboxNSFilter) Then
mySearch = mySearch & " and [North or South] = '" & Me.cboxNSFilter & "' "
End If
If Not IsNull(Me.cboxPRCFilter) Then
mySearch = mySearch & " and PRC = '" & Me.cboxPRCFilter & "' "
End If
Me.asfAddressAllSubform.Form.RecordSource = mySearch
Me.asfAddressAllSubform.Form.Requery