Databases Reference
In-Depth Information
Dim db As DATABASE
Dim rsTable As Recordset
Dim rsDyna As Recordset
Dim rsSnap As Recordset
Set db = CurrentDb
' Open table-type recordset
Set rsTable = db.OpenRecordset("Books")
Debug.Print "TableCount: " & rsTable.RecordCount
' Open dynaset-type recordset
Set rsDyna = db.OpenRecordset("Books", dbOpenDynaset)
Debug.Print "DynaCount: " & rsDyna.RecordCount
rsDyna.MoveLast
Debug.Print "DynaCount: " & rsDyna.RecordCount
' Open snapshot-type recordset
Set rsSnap = db.OpenRecordset("Books", dbOpenSnapshot)
Debug.Print "SnapCount: " & rsSnap.RecordCount
rsSnap.MoveLast
Debug.Print "SnapCount: " & rsSnap.RecordCount
' Close all
rsTable.Close
rsDyna.Close
rsSnap.Close
End Sub
16.2.2 Default Recordset Types
If you do not specify a type in the OpenRecordset method, Jet will choose one for you
according to the following rules:
The default Type when opening a recordset on a Database object (first syntax) or
a TableDef object (second syntax) is a table-type Recordset object.
The default Type when opening a recordset on a QueryDef object is a dynaset-
type Recordset object. (Table-type recordsets are not available.)
The default Type when opening a recordset on an existing table-type Recordset
object is a dynaset-type recordset. If the recordset is not table-type, then the new
recordset has the same type as the original.
16.3 Moving Through a Recordset
All recordsets have a current position (pointed to by the current record pointer ) and a
current record . Normally, the current record is the record at the current position.
However, there are two exceptions. The current position can be:
Before the first record
After the last record
 
Search WWH ::




Custom Search