Friday, December 30, 2011

How, When & Why Grid Reconstructs

This blog is meant to shed some lights why grid reconstruction happens.

Grid is an object in form that can show the records in a table view.  When you do not use .RecordSource property, it will grab whatever is the current active table and use.  When we use RecordSource property, then it will show the records of the source.  While there are four (4) RecordSourceType to choose from, I will focus only on two (2) of those here:

a.  If I am using Safe Select (2 cursors) Approach, then it is .RecordSourceType = 1 - Alias.
b.  If I am using a single cursor approach (the same cursor gets overwritten over and over again), then it is .RecordSourceType = 4 - SQL Statement, for me.

Depending on my need, I switch either with RecordSourceType 1 or 4.