How to add a filter in Visual Basic?

D

danijela.simunovic

How do I add a filter in VB?
is this enough: DoCmd.ApplyFilter , "LastName = 'King'" or I
need something before this which would say in which table or query?
And how do i close the filter,how do i remove it?

Danijela
 
V

Van T. Dinh

DoCmd.ApplyFilter does not have an argument for the object the Filter will
be applied to. The filter will always be applied to the *active* data
object, i.e. the object in active MDI window which can be DatasheetView of a
Table / a Query or a Form. For Reports, the ApplyFilter will only work in
the Open Event.
 
Top