>

FillCache Method

Applies To

Dynaset-Type Recordset Object, Recordset Object.

Description

Fills all or a part of a local cache for a Recordset object that contains data from an ODBC data source.

Syntax

recordset.FillCache [rows[, start]]

The FillCache method syntax has these parts.

Part Description
recordset A Recordset object created from an ODBC data source, such as a TableDef representing an attached table or a QueryDef object derived from such a TableDef.
rows An Integer specifying the number of rows to fill in the cache. If you omit this argument, the value is determined by the CacheSize property setting.
start A string specifying a bookmark. The cache is filled starting from the record indicated by this bookmark. If you omit this argument, the cache is filled starting from the record indicated by the CacheStart property.
Remarks

Caching improves the performance of an application that retrieves, or fetches, data from a remote server. A cache is space in local memory that holds the data most recently fetched from the server on the assumption that the data will probably be requested again while the application is running. When data is requested, the Microsoft Jet database engine checks the cache for the data first rather than fetching it from the server, which takes more time. Data that doesn't come from an ODBC data source isn't saved in the cache.

Rather than waiting for the cache to be filled with records as they are fetched, you can explicitly fill the cache at any time using the FillCache method. This is a faster way to fill the cache because FillCache fetches several records at once instead of one at a time. For example, while each screenful of records is being displayed, you can have your application use FillCache to fetch the next screenful of records.

Any ODBC database accessed with Recordset objects can have a local cache. To create the cache, open a Recordset object from the remote data source, and then set the CacheSize and CacheStart properties of the Recordset.

If rows and start create a range of records that is partly or wholly outside the range of records specified by the CacheSize and CacheStart properties, the portion of the recordset outside this range is ignored and isn't loaded into the cache.

If FillCache requests more records than remain in the remote data source, only the remaining records are fetched, and no error occurs.

Notes

See Also

Bookmark Property; Bookmarkable Property; CacheSize, CacheStart Properties.

Specifics (Microsoft Access)

When you use a bookmark in a Microsoft Access module, you must include an Option Compare Binary statement in the Declarations section of the module. A bookmark is a Variant array of Byte data, so the string comparison method for the module must be binary. If a bookmark is evaluated with a text-based string comparison method, the current record may be set to an incorrect record. The Option Compare Text statement denotes a text-based comparison method, as does the default setting for the Option Compare Database statement.

Example (Client/Server)

See the CacheSize, CacheStart properties example.

Example (Microsoft Access)

See the CacheSize, CacheStart properties example (Microsoft Access).