Link to home
Start Free TrialLog in
Avatar of MichaelDJ2000
MichaelDJ2000

asked on

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
Avatar of Mike Eghtebas
Mike Eghtebas
Flag of United States of America image

use:

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

Btw, tomorrow I will be able to take a look at you other question you sent.

mike
ASKER CERTIFIED SOLUTION
Avatar of Mike Eghtebas
Mike Eghtebas
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MichaelDJ2000
MichaelDJ2000

ASKER

egtebas

Thanks.  Worked great!

As you can see, i'm learning as i go  (sink or swim)

Looking forward to your results on the previous question.

Also, is there a good Visual Basic Access reference book that you can recommend?   I'm looking for a book that has a listing and description of the commands/statements.  Have not had any luck finding such a book.  (Based on my questions, you might have an idea of a book that might help)

MichaelDJ
Mastering Access (CD by examples) is what I have used in early 1990s.  I don't know very many books on this subject.  Generally, QUE has good books on all subjects.  I whish we hade EE way back in 90s when I started learning Access.

Thank you for the grade.

Mike