strong888hold
New member
- Local time
- Today, 02:39
- Joined
- Nov 29, 2006
- Messages
- 6
Hi
I used this small database (see zip file attached) to adapt it to mine. I added 4 combo boxes (the database attached has 5 combo boxes)
I can select values in any of my combo boxes, my report property is set to “Filter On” however when I click on the Set Filter Button it shows an error message “Microsoft Access cannot find Filter(1,2,3 or which every filter i click on) contained in your expression” There is some error or text missing within the set filter Command button expression. How can I ensure all of my combo boxes are included in my SQL expression?
The SQL Script is shown below is what i have copied. The text highlighted in red is what the debug program highlights.
I tried to change the Me("Filter...) to Me.Filter = "[OwnerID]= & Chr(34) & Me.OwnerID.Value & Chr(34)...but I have the same problem and my report cannot be filtered until I debug this.
Hope anyone has a better idea.
Thanks
strong888hold
I used this small database (see zip file attached) to adapt it to mine. I added 4 combo boxes (the database attached has 5 combo boxes)
I can select values in any of my combo boxes, my report property is set to “Filter On” however when I click on the Set Filter Button it shows an error message “Microsoft Access cannot find Filter(1,2,3 or which every filter i click on) contained in your expression” There is some error or text missing within the set filter Command button expression. How can I ensure all of my combo boxes are included in my SQL expression?
The SQL Script is shown below is what i have copied. The text highlighted in red is what the debug program highlights.
Code:
Private Sub Set_Filter_Click()
Dim strSQL as String, intCounter as Integer
' Build SQL String.
For intCounter = 1 To 5
[COLOR="Red"]If Me("Filter" & intCounter) <> "" Then[/COLOR]
strSQL = strSQL & "[" & Me("Filter" & intCounter).Tag & "] " _
& " = " & Chr(34) & Me("Filter" & intCounter) & Chr(34) & " _
And "
End If
Next
If strSQL <> "" Then
' Strip Last " And ".
strSQL = Left(strSQL, (Len(strSQL) - 5))
' Set the Filter property.
Reports![rptBy].Filter = strSQL
Reports![rptBy].FilterOn = True
End If
End Sub
I tried to change the Me("Filter...) to Me.Filter = "[OwnerID]= & Chr(34) & Me.OwnerID.Value & Chr(34)...but I have the same problem and my report cannot be filtered until I debug this.
Hope anyone has a better idea.
Thanks
strong888hold