this is the code i have behide Apply filter i have 4 option group and one
combo box. at the end do i just add the code you told me so it will be
requery to the subform. I have a table really its a query that is link to
the subform that shows all the fields from the main table. do i have to
have a totally different code to filter on a subform instead of the report?
Dim strAdtype As String
Dim strbookname As String
Dim stradvertiser As String
Dim strheading As String
Dim strudac As String
Dim strfilter As String
Select Case Me.fraAdType.Value
Case 1
strAdtype = "='Comp'"
Case 2
strAdtype = "='YB'"
Case 3
strAdtype = "='Canceled'"
Case 4
strAdtype = "like '*'"
End Select
If IsNull(Me.txtbookname.Value) Then
strbookname = "Like '*'"
Else
Select Case Me.fraBookName.Value
Case 1
strbookname = "Like '" & Me.txtbookname.Value & "*'"
Case 2
strbookname = "Like '*" & Me.txtbookname.Value & "*'"
Case 3
strbookname = "Like '*" & Me.txtbookname.Value & "'"
Case 4
strbookname = "= '" & Me.txtbookname.Value & "'"
End Select
End If
If IsNull(Me.txtAdvertiser.Value) Then
stradvertiser = "Like '*'"
Else
Select Case Me.fraAdvertiser.Value
Case 1
stradvertiser = "Like '" & Me.txtAdvertiser.Value & "*'"
Case 2
stradvertiser = "Like '*" & Me.txtAdvertiser.Value & "*'"
Case 3
stradvertiser = "Like '*" & Me.txtAdvertiser.Value & "'"
Case 4
stradvertiser = "= '" & Me.txtAdvertiser.Value & "'"
End Select
End If
If IsNull(Me.TxtHeading.Value) Then
strheading = "Like '*'"
Else
Select Case Me.FraHeading.Value
Case 1
strheading = "like '" & Me.TxtHeading.Value & "*'"
Case 2
strheading = "Like '*" & Me.TxtHeading.Value & "*'"
Case 3
strheading = "Like '*" & Me.TxtHeading.Value & "'"
Case 4
strheading = Me.TxtHeading.Value & ""
End Select
End If
If IsNull(Me.CboUDAC.Value) Then
strudac = "like '*'"
Else
strudac = "='" & Me.CboUDAC.Value & "'"
End If
strfilter = "[type] " & strAdtype & " and [bookname] " & strbookname & "
and [advertiser] " & stradvertiser & " and
" & strheading & " and
[udac_code]" & strudac
With Reports![rptmeterad]
.filter = strfilter
.FilterOn = True
End With