dynamictiger
Technical User
I have the following code which is wrong:
Sub LastCount()
Dim dbs As Database
Dim rst As Recordset
Set dbs = CurrentDb
With dbs
' Open dynaset-type Recordset and show RecordCount
' property before populating the Recordset.
Set rst = .OpenRecordset("SELECT Sum(qryResults.NoBuy) AS SumOf NoBuy FROM qryResults;", _
dbOpenDynaset)
' Show the RecordCount property after populating the
' Recordset.
rst.MoveLast
Debug.Print "Snapshot-type recordset " & _
"from Employees table after MoveLast"
Debug.Print " RecordCount = " & _
rst.RecordCount
rst.Close
.Close
End With
End Sub
The code does not run. I don't know why.![[sadeyes] [sadeyes] [sadeyes]](/data/assets/smilies/sadeyes.gif)
Sub LastCount()
Dim dbs As Database
Dim rst As Recordset
Set dbs = CurrentDb
With dbs
' Open dynaset-type Recordset and show RecordCount
' property before populating the Recordset.
Set rst = .OpenRecordset("SELECT Sum(qryResults.NoBuy) AS SumOf NoBuy FROM qryResults;", _
dbOpenDynaset)
' Show the RecordCount property after populating the
' Recordset.
rst.MoveLast
Debug.Print "Snapshot-type recordset " & _
"from Employees table after MoveLast"
Debug.Print " RecordCount = " & _
rst.RecordCount
rst.Close
.Close
End With
End Sub
The code does not run. I don't know why.
![[sadeyes] [sadeyes] [sadeyes]](/data/assets/smilies/sadeyes.gif)