If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Filtering using subform
i have a form with three Option groups and one combo box and i am
trying to filter it out to the subform that i have on the same form. here is the code, everytime i try to click on Apply Filter. its not working. my filter is not showing on the subform. this code is behide Apply filter command on the main form. so i need code behide the subform. the Subform contains the main table that show all the fields. Dim strmarket As String Dim stradvertisers As String Dim strheading As String Dim strudac As String Dim strfilter As String If IsNull(Me.txtmarket.Value) Then strmarket = "Like '*'" Else Select Case Me.fraMarket.Value Case 1 strmarket = "Like '" & Me.txtmarket.Value & "*'" Case 2 strmarket = "Like '*" & Me.txtmarket.Value & "*'" Case 3 strmarket = "Like '*" & Me.txtmarket.Value & "'" Case 4 strmarket = "= '" & Me.txtmarket.Value & "'" End Select End If If IsNull(Me.txtAdvertisers.Value) Then stradvertisers = "Like '*'" Else Select Case Me.fraAdvertisers.Value Case 1 stradvertisers = "Like '" & Me.txtAdvertisers.Value & "*'" Case 2 stradvertisers = "Like '*" & Me.txtAdvertisers.Value & "*'" Case 3 stradvertisers = "Like '*" & Me.txtAdvertisers.Value & "'" Case 4 stradvertisers = "= '" & Me.txtAdvertisers.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 = "[market] " & strmarket & " and [advertisers] " & stradvertisers & " and [heading]" & strheading With SubForm![frmMeterAdSubform] ..filter = strfilter ..FilterOn = True End With End sub |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Main form -subform keeping count | babs | Using Forms | 22 | May 5th, 2006 03:50 AM |
subform filtering problem | TMH | Using Forms | 0 | May 10th, 2005 04:34 PM |
Subform on Subform problem | JohnB | Using Forms | 4 | April 10th, 2005 12:52 PM |
Filtering from a Subform | Pete Klein | Database Design | 6 | January 2nd, 2005 06:45 PM |
Subform Refresh Problem (but only with an unbound combo box control) | Barry Skidmore | Using Forms | 1 | December 21st, 2004 01:19 AM |