I have a form that has a requery button and a separate form filter button. The form has two unbound fields that are referenced in the forms Query criteria. When I first enter the form without applying filters, the requery button accurately refreshes the form based on the values entered into the unbound fields.
The code behind the Requery button is:
Private Sub Refresh_Click()
If Me.FilterOn = True Then
Me.FilterOn = False
DoCmd.RunCommand acCmdRemoveFilterSort
End If
DoCmd.Requery
DoCmd.GoToRecord acDataForm, "TRIPHeader", acLast
End Sub
After applying the filter button (which executes some specific filtering)
Private Sub Qlikview_Filter_Click()
Me.Filter = "TRIP_ID in (SELECT TRIP_ID FROM QlikviewList)"
DoCmd.RunCommand acCmdApplyFilterSort
End Sub
I then want to go back to the Requery button the Query criteria (stored in the Query itself) does not take effective. All possible rows from the form query are returned even though my unbound fields in the form are referenced in the query criteria. I have tried all sorts of combinations of removing the filter but I still seems that any time a filter is applied and then after it is removed the Forms Query Criteria is no longer functioning properly. Any help would be creatly appreciated on this.
Additionally I have also found that if i click on the Remove Filter icon on the Filter/Sort toolbar the above Requery Button works fine so it appears that there is something different happening when I use the toolbar Remove Filter vs when i use the DoCmd.RunCommand acCmdRemoveFilterSort orMe.FilterOn = False commands
The code behind the Requery button is:
Private Sub Refresh_Click()
If Me.FilterOn = True Then
Me.FilterOn = False
DoCmd.RunCommand acCmdRemoveFilterSort
End If
DoCmd.Requery
DoCmd.GoToRecord acDataForm, "TRIPHeader", acLast
End Sub
After applying the filter button (which executes some specific filtering)
Private Sub Qlikview_Filter_Click()
Me.Filter = "TRIP_ID in (SELECT TRIP_ID FROM QlikviewList)"
DoCmd.RunCommand acCmdApplyFilterSort
End Sub
I then want to go back to the Requery button the Query criteria (stored in the Query itself) does not take effective. All possible rows from the form query are returned even though my unbound fields in the form are referenced in the query criteria. I have tried all sorts of combinations of removing the filter but I still seems that any time a filter is applied and then after it is removed the Forms Query Criteria is no longer functioning properly. Any help would be creatly appreciated on this.
Additionally I have also found that if i click on the Remove Filter icon on the Filter/Sort toolbar the above Requery Button works fine so it appears that there is something different happening when I use the toolbar Remove Filter vs when i use the DoCmd.RunCommand acCmdRemoveFilterSort orMe.FilterOn = False commands
Last edited: