Recordset Population

Regardless of which type of Recordset object you use, they are populated in the same way. When you first call the OpenRecordset method, Microsoft Jet returns control to your program as soon as the first record is available. At that stage, no other records have been retrieved. In other words, in the case of a dynaset-type Recordset object, only one primary key value has been retrieved from the server, and in the case of a snapshot-type or forward-only-type Recordset, only one record of data has been retrieved. If you close the Recordset at this stage, that is the sum total of all data that is retrieved.

You probably want more than one record, however. Therefore, each time you move the cursor forward (for instance, by using the MoveNext method, or the Move method with a positive value in the rows argument), Microsoft Jet retrieves either bookmarks (dynaset-type) or record data (snapshot-type or forward-only-type) until it reaches the end of the requested records. Issuing a MoveLast method forces Microsoft Jet to retrieve all data.

If you are using a Microsoft Access form or the Microsoft Visual Basic Data control, then some background retrieval is done for you. For example, while the first record is being displayed on a form, Microsoft Access is retrieving the bookmark (dynaset-type) or data (snapshot-type or forward-only-type) for subsequent records while checking the keyboard to see if the user has typed anything. The Visual Basic Data control does the same thing. You can adjust the size and rate of these retrievals with the MSysConf table described in “Using the MSysConf Table to Configure Microsoft Jet” later in this chapter. For Visual Basic, you can additionally control the dynaset cache size by setting the CacheSize property of the Recordset and then assigning the Recordset to the Data control’s Recordset property. By default, the Data control caches 50 records.