When dreaming up names for stuff, you want to avoid using reserved words. In the example below, I have used intCount as a variable name. When you open a DAO.Recordset, the default type is dbopendynaset, which is type dynaset. You will want to populate the entire Recordset prior to getting a RecordCount. In the example below, I have added a MoveLast method. Before retrieving data from a specific record, you may want to MoveFirst or...
Code:
Dim SQL As String
Dim intCount As Integer
Dim dbs2 As DAO.Database
Dim rst2 As DAO.Recordset
Set dbs2 = CurrentDb
SQL = "Select * from tempLine WHERE LineExpenseID = " & Me.ExpenseID
Set rst2 = dbs2.OpenRecordset(SQL)
rs2.movelast
intCountCount = rst2.RecordCount
MsgBox ("Record count = " & Count)