How to filter a CurrentDb.OpenRecordset?

Posted on 2004-11-16
Last Modified: 2012-08-13
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?

Question by:MichaelDJ2000
    LVL 33

    Expert Comment

    by:Mike Eghtebas

    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.

    LVL 33

    Accepted Solution


    Dim MyVal As Long


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


    Author Comment


    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)

    LVL 33

    Expert Comment

    by:Mike Eghtebas
    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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    In the article entitled Working with Objects – Part 1 (, you learned the basics of working with objects, properties, methods, and events. In Work…
    In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
    In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
    In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now