Hi;
I am using .FilterOn = True , when it executes the system popup "Enter parameter Value", I do not understand why ?
I have designed a report. By default it executes for all records. After execution there is a form where a list box contains values to filter the report. After selecting the required value. When press button "Filter Record" it executes the below code :
Dim varItem As Variant
Dim strBaseStation As String
Dim strFleetType As String
Dim strEngineType As String
Dim strFilter As String
'Check that the report is open
If SysCmd(acSysCmdGetObjectState, acReport, "rpt1ActEmpSch_qry") <> acObjStateOpen Then
DoCmd.OpenReport "rpt1ActEmpSch_qry", acViewPreview
Exit Sub
End If
' Build criteria string from lstPayType listbox
For Each varItem In Me.lstPayType.ItemsSelected
strBaseStation = strBaseStation & "," & Me.lstPayType.ItemData(varItem)
Next varItem
If Len(strBaseStation) = 0 Then
strBaseStation = "Like '*'"
Else
strBaseStation = Right(strBaseStation, Len(strBaseStation) - 1)
strBaseStation = "IN (" & strBaseStation & ")"
End If
' Build filter string
strFilter = "[PayType] " & strBaseStation
MsgBox "" & strFilter & "."
' Apply the filter and switch it on
With Reports("rpt1ActEmpSch_qry")
.Filter = strFilter
.FilterOn = True
End With
When the second last line " .FilterOn = True " executes the Enter parameter dialog box appear. Why.... I do not understand it should filter the report without appearing this dialog box. I do not understand where I am missing something ?
Any suggestion will be highly appreciated
Regards
Muaz
I am using .FilterOn = True , when it executes the system popup "Enter parameter Value", I do not understand why ?
I have designed a report. By default it executes for all records. After execution there is a form where a list box contains values to filter the report. After selecting the required value. When press button "Filter Record" it executes the below code :
Dim varItem As Variant
Dim strBaseStation As String
Dim strFleetType As String
Dim strEngineType As String
Dim strFilter As String
'Check that the report is open
If SysCmd(acSysCmdGetObjectState, acReport, "rpt1ActEmpSch_qry") <> acObjStateOpen Then
DoCmd.OpenReport "rpt1ActEmpSch_qry", acViewPreview
Exit Sub
End If
' Build criteria string from lstPayType listbox
For Each varItem In Me.lstPayType.ItemsSelected
strBaseStation = strBaseStation & "," & Me.lstPayType.ItemData(varItem)
Next varItem
If Len(strBaseStation) = 0 Then
strBaseStation = "Like '*'"
Else
strBaseStation = Right(strBaseStation, Len(strBaseStation) - 1)
strBaseStation = "IN (" & strBaseStation & ")"
End If
' Build filter string
strFilter = "[PayType] " & strBaseStation
MsgBox "" & strFilter & "."
' Apply the filter and switch it on
With Reports("rpt1ActEmpSch_qry")
.Filter = strFilter
.FilterOn = True
End With
When the second last line " .FilterOn = True " executes the Enter parameter dialog box appear. Why.... I do not understand it should filter the report without appearing this dialog box. I do not understand where I am missing something ?
Any suggestion will be highly appreciated
Regards
Muaz