18/28 – Opening A Query As A Recordset

Click here to go to the downloads page.
Please select: VBAIntermediate05

Related Posts

01/28 – Creating A Calendar
02/28 – Generating SQL
03/28 – Manipulating Combo Boxes
04/28 – Calling Sub Procedures
05/28 – Variable Scope
06/28 – OnLoad Event
07/28 – Break On All Errors
08/28 – Option Explicit
09/28 – Initialising Variables
10/28 – DateSerial Function
11/28 – Weekday Function
12/28 – DateAdd Function
13/28 – DateDiff Function
14/28 – Function To Return Days In Month
15/28 – Multi-Dimensional Array
16/28 – For Loops And Arrays
17/28 – Month Function
19/28 – Filtering A Recordset
20/28 – RecordCount Property
21/28 – BOF and EOF
22/28 – Do While
23/28 – Comments
24/28 – Dynamically Creating Variable Names
25/28 – Tag Property
26/28 – Referencing Active Controls
27/28 – Writing Lots Of Code Quickly!
28/28 – HyperLinks

As always, a site wouldn't be anything without its users so please feel free to comment! We welcome any comments you have on the material and any suggestions you may have for future content.


In our humble opinion, it is worth commenting just so you can play with Fun Captcha below!

3 Comments

  • Steve Winkler says:

    well after some googling and playing around with the sub procedure I have to add a .movelast. so my block looks like:
    With rs
    .MoveLast
    Debug.Print .RecordCount
    .Close
    End With

    I’m not sure why I had to add the movelast though.

    • Robert Austin says:

      Hi Steve

      It is because the recordcount property only populates when it has iterated over every record. Not sure if it is a bug or not!

  • Steve Winkler says:

    So I’ve got a query that returns 65 records. When I try to run it as a sub procedure as you’ve done it only returns 1. Any thoughts as to why?

Leave a Reply

Your email address will not be published. Required fields are marked *