G
Guest
I built a calendar based on one of Duane Hookom's calendar samples:
http://www.access.hookom.net/Samples.htm
Now I'm trying to make my calendar dynamic using techniques from Martin
Green's website:
http://fontstuff.com/access/acctut19.htm
My calendar report has 4 subreports on it. The "Multi-Select List Box" form
I created for filtering works on each of the subreports individually, but
when I switch it to the main report, I get a "Enter Parameter Value" box for
"CS Person." I suspect this is because the field "CS Person" doesn't actually
appear on the main report, but I don't know how to work around this.
Any suggestions would be appreciated. The code for the "apply filter" button
on my form is below in case that helps.
Many thanks,
jkatj
Private Sub ApplyButton_Click()
Dim varItem As Variant
Dim strPerson As String
Dim strFilter As String
' Open report
DoCmd.OpenReport "Calendar - Landscape", acViewPreview
' Build criteria string from [CS Person box] listbox
For Each varItem In Me.CS_Person_box.ItemsSelected
strPerson = strPerson & ",'" & Me.CS_Person_box.ItemData(varItem) _
& "'"
Next varItem
If Len(strPerson) = 0 Then
strPerson = "Like '*'"
Else
strPerson = Right(strPerson, Len(strPerson) - 1)
strPerson = "IN('-Office Closed-'," & strPerson & ")"
End If
' Build filter string
strFilter = "[CS Person] " & strPerson
' Apply the filter and switch it on
With Reports![Calendar - Landscape]
.Filter = strFilter
.FilterOn = True
End With
End Sub
http://www.access.hookom.net/Samples.htm
Now I'm trying to make my calendar dynamic using techniques from Martin
Green's website:
http://fontstuff.com/access/acctut19.htm
My calendar report has 4 subreports on it. The "Multi-Select List Box" form
I created for filtering works on each of the subreports individually, but
when I switch it to the main report, I get a "Enter Parameter Value" box for
"CS Person." I suspect this is because the field "CS Person" doesn't actually
appear on the main report, but I don't know how to work around this.
Any suggestions would be appreciated. The code for the "apply filter" button
on my form is below in case that helps.
Many thanks,
jkatj
Private Sub ApplyButton_Click()
Dim varItem As Variant
Dim strPerson As String
Dim strFilter As String
' Open report
DoCmd.OpenReport "Calendar - Landscape", acViewPreview
' Build criteria string from [CS Person box] listbox
For Each varItem In Me.CS_Person_box.ItemsSelected
strPerson = strPerson & ",'" & Me.CS_Person_box.ItemData(varItem) _
& "'"
Next varItem
If Len(strPerson) = 0 Then
strPerson = "Like '*'"
Else
strPerson = Right(strPerson, Len(strPerson) - 1)
strPerson = "IN('-Office Closed-'," & strPerson & ")"
End If
' Build filter string
strFilter = "[CS Person] " & strPerson
' Apply the filter and switch it on
With Reports![Calendar - Landscape]
.Filter = strFilter
.FilterOn = True
End With
End Sub