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
MichaelDJ2000Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike EghtebasDatabase and Application DeveloperCommented:
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
0
Mike EghtebasDatabase and Application DeveloperCommented:
or,

Dim MyVal As Long

MyVal=707

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

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MichaelDJ2000Author Commented:
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
0
Mike EghtebasDatabase and Application DeveloperCommented:
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
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.