Hello,
I have a form with a subform. I am trying to filter the subform using mulitple text boxes and combos for search criteria. I have a command button to submit the request. In my subs I am using filter and filteron properties and methods.
The issue is this.
If I bring up the form intially and select my criteria and then click my search button. It does nothing. If I click it a second time it filters correctly, which is rather annoying. Afterwards the button works like a charm.
The code is this:
Dim strStatus As Integer
If Not Namecbo = "" And Not cbo_status = "" Then
Me.Filter = "[Station_Name]= '" & Namecbo & "'"
Me.FilterOn = True
If cbo_status = "Closed" Then
strStatus = -1
Else
strStatus = 0
End If
Form_sub_frm_station_history.Filter = "[Closed]= '" & strStatus & "'"
Form_sub_frm_station_history.FilterOn = True
Else
End If
If Not Namecbo = "" And cbo_status = "" Then
Me.Filter = "[Station_Name]= '" & Namecbo & "'"
Me.FilterOn = True
Else
End If
If Not cbo_status = "" And Namecbo = "" Then
If cbo_status = "Closed" Then
strStatus = -1
Else
strStatus = 0
End If
Form_sub_frm_station_history.Filter = "[Closed]= '" & strStatus & "'"
Form_sub_frm_station_history.FilterOn = True
Else
End If
Namecbo = ""
cbo_status = ""
Any idea how to get it work intially with out having to click the button a second time.