Question : How to filter a CurrentDb.OpenRecordset?

The filter that I am using, see below, has no affect.  That is, the result is the same with or without the filter statements.  In the example, below, I'm trying to gather all records whose CustIDs are 707.  (in the final code, 707 would be a variable, but I'm now using a constant for testing)

With CurrentDb.OpenRecordset("Tabletbl1", dbOpenDynaset)
         .Filter = "[CustIds]= 707"  
         rsFiltered = OpenRecordset
             .
             .
             .
    End With

Again, works fine.  But, is ignoring the filter.  What am I doing wrong?

MichaelDJ

Answer : How to filter a CurrentDb.OpenRecordset?

or,

Dim MyVal As Long

MyVal=707

Set rs= CurrentDb.OpenRecordset("Select * From Tabletbl1 Where [CustIds]=" & MyVal, dbOpenDynaset)

Random Solutions  
 
programming4us programming4us