I have a Form ‘frmMsg’. (This is the Main Form)
I have a Pivot Table Form called ‘pvtMsgLayer’ with a built in Record Source Query. (This is the Sub Form)
I am using VBA to open the Main Form. The part I am having trouble with is Filtering the Sub Form with a Comma Separated Values string using VBA.
The following code works for me I just want to open the Sub Form (Filtered):
Public strLayStatID AS String
strLayStatID = “12, 16, 79, 88”
DoCmd.OpenForm "pvtMsgLayer", acFormPivotTable, , "LayerStatusID In (" & strLayStatID & ")"
I found examples where I could use the following Filter Array in the Sub Form Load Event, but I am not familiar with how to turn a Comma Separated Values string into an Array :
Private Sub Form_Load()
Dim arrFilter As Variant
arrFilter = Array(8, 11)
Me.PivotTable.ActiveView.RowAxis.FieldSets("LayerStatusID") _
.Fields("LayerStatusID").IncludedMembers = arrFilter
End Sub
I exhausted my search efforts with no solution. Any help would be extremely appreciated.
Thanks in advance,
Dave
I have a Pivot Table Form called ‘pvtMsgLayer’ with a built in Record Source Query. (This is the Sub Form)
I am using VBA to open the Main Form. The part I am having trouble with is Filtering the Sub Form with a Comma Separated Values string using VBA.
The following code works for me I just want to open the Sub Form (Filtered):
Public strLayStatID AS String
strLayStatID = “12, 16, 79, 88”
DoCmd.OpenForm "pvtMsgLayer", acFormPivotTable, , "LayerStatusID In (" & strLayStatID & ")"
I found examples where I could use the following Filter Array in the Sub Form Load Event, but I am not familiar with how to turn a Comma Separated Values string into an Array :
Private Sub Form_Load()
Dim arrFilter As Variant
arrFilter = Array(8, 11)
Me.PivotTable.ActiveView.RowAxis.FieldSets("LayerStatusID") _
.Fields("LayerStatusID").IncludedMembers = arrFilter
End Sub
I exhausted my search efforts with no solution. Any help would be extremely appreciated.
Thanks in advance,
Dave