In a recent program that I wrote, I needed to store a count of records from a query in a variable. Since VBA and Access isn't as intuitive as say connecting to a MySQL database with PHP, I thought I would share. Function recordCount() Dim rs As DAO.Recordset Dim db As Database Dim strSQL As String Set db = CurrentDb 'Count Query - replace query with your … [Read more...] about How to Count Records in VBA | Microsoft Access 2010