X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> How To Filter A Control On Subform 2 Using A Tempvars Filter Form, Access 2016    
post Dec 24 2017, 04:08 PM

Posts: 479
Joined: 15-December 15

Hello I have a main form named frmMainForm
it has two subforms. Subform 1 is named sbfFlights and subform 2 is named sbfFlightPrices

I have a command button in the header of the Main Form called cmdOpenFilterForm. This command button has the following code in its Event Property
Private Sub cmdOpenFilterForm_Click()
DoCmd.OpenForm "frmFilter", WindowMode:=acDialog
' frmFilter opens, and the filter string is assembled as described below
If Not IsNull(TempVars!FilterRoutes) Then
    Me.Filter = TempVars!FilterRoutes
    Me.FilterOn = True
End If
End Sub

The cmdOpenFilterForm command button opens a TempVars Filter Form which has a command button called cmdApplyFilter. This command button has the following code.
  If Not IsNull(Me.txtFilterPriceUpdatedOnOrAfter) Then
        strWhere = strWhere & "(Me.sbfFlights.Form.sbfFlightPrices.Form.DatePriceEntered >= " & Format(Me.txtFilterPriceUpdatedOnOrAfter, conJetDate) & ") AND "
    End If

My problem:
I want to filter the MainForm and Subforms by entering a date into a textbox named Me.txtFilterPriceUpdatedOnOrAfter on the Tempvars filter form.
The textbox would filter the DatePriceEntered Field on Subform2

I tried to reference the control on subform 2 like this
but its not working

Can anyone figure out whats wrong with this.
Thank you
Go to the top of the page
post Dec 25 2017, 02:51 AM

UtterAccess VIP
Posts: 8,823
Joined: 10-February 04
From: South Charleston, WV

Is the value there? I mean if you stop the code and put the cursor on it can you see the value. The reason I ask is sometimes when people filter they forget to FilterOn = True. So they have the correct value but the filter doesn't take place.

Robert Crouser

Go to the top of the page

Custom Search
RSSSearch   Top   Lo-Fi    23rd January 2018 - 07:05 PM