FillCache Method


Fills all or a part of a local cache for a Recordset object that contains data from a Microsoft Jet-connected ODBC data source (Microsoft Jet-connected ODBC databases only).


recordset.FillCache rows, startbookmark

The FillCache method syntax has these parts.




An object variable that represents a Recordset object created from an ODBC data source, such as a TableDef representing a linked table or a QueryDef object derived from such a TableDef.


Optional. A Variant (Integer subtype) that specifies the number of rows to store in the cache. If you omit this argument, the value is determined by the CacheSize property setting.


Optional. A Variant (String subtype) that specifies 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.



Caching improves the performance of an application that retrieves data from a remote server. A cache is space in local memory that holds the data most recently retrieved from the server; this assumes that the data will probably be requested again while the application is running. When a user requests data, the Microsoft Jet database engine checks the cache for the data first rather than retrieving it from the server, which takes more time. The cache doesn't save data that doesn't come from an ODBC data source.

Rather than waiting for the cache to be filled with records as they are retrieved, you can use the FillCache method to explicitly fill the cache at any time. This is a faster way to fill the cache because FillCache retrieves several records at once instead of one at a time. For example, while you view each screenful of records, your application uses FillCache to retrieve the next screenful of records for viewing.

Any Microsoft Jet-connected ODBC data source that you access 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 startbookmark create a range of records that is partially or entirely outside the range of records specified by the CacheSize and CacheStart properties, the portion of the recordset outside this range is ignored and will not be loaded into the cache.

If FillCache requests more records than the number remaining in the remote data source, Microsoft Jet retrieves only the remaining records, and no error occurs.


?Records retrieved from the cache don't reflect concurrent changes that other users made to the source data.


?FillCache only retrieves records not already cached. To force an update of all the cached data, set the CacheSize property of the Recordset to 0, reset it to the size of the cache you originally requested, and then use FillCache.