Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dialog box to filter report

Status
Not open for further replies.

NeilPattison

IS-IT--Management
Aug 24, 2005
52
GB
I have set up a report called rptAbsence, and also a dialog box called frmAbsenceFilter. This dialog box is a form containing a combo box and 2 command buttons (apply and remove). The combo box comes from a table called[Issues].

The problem I'm having is when I apply the filter a box pops up asking for a parameter value for [issue].

The code I have used for the dialog box is below

Private Sub cmdApplyFilter_Click()
Dim strIssue As String
Dim strFilter As String
' Checks that the report is open
If SysCmd(acSysCmdGetObjectState, acReport, "rptAbsence") <> acObjStateOpen Then
MsgBox "You must open the report first."
Exit Sub
End If
' Builds the criteria string for the Issue field
If IsNull(Me.cboIssue.Value) Then
strIssue = "Like '*'"
Else
strIssue = "='" & Me.cboIssue.Value & "'"
End If
strFilter = "[Issue] " & strIssue
' Applies the filter and switchs it on
With Reports![rptAbsence]
.Filter = strFilter
.FilterOn = True
End With
End Sub
----------------------------------------------------------------------
Private Sub cmdRemoveFilter_Click()
On Error Resume Next
Reports![rptAbsence].FilterOn = False
End Sub


Does anyone know why this is occuring and how it can be resolved? Any help would be greatly appreciated
 
Thanks for replying Zameer. It seems according to that tutorial the code is right but this problem is still occuring. Any other ideas?
 
It here the parameter pops up
Code:
strIssue = "='" & Me.cboIssue.Value & "'"
End If
strFilter = "[b][Issue][/b] " & strIssue
Are you sure the field name is correct?

________________________________________________________
Zameer Abdulla
Help to find Missing people
You may be the boss' pet; but you are still an animal
 
Yeah the field name is definately correct. I have used the exact same code for another report I have by just changing the field names and combo box names and it works perfectly
 
So the problem could be in the report. Check the Grouping & Sorting has nothing unwanted there. Or try creating a new report

Also.. if you are using a query for the report as recorsource then see its criteria grid too

________________________________________________________
Zameer Abdulla
Help to find Missing people
You may be the boss' pet; but you are still an animal
 
The reports recordsource is a table called Projects and it does contain the field Issue
 
Hi thanks for all your help, its sorted now. The field name was actually put in incorrectly I was just being blind and not noticing a space in the field name i.e. [Issu e]

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top