(Mike Mitchell)
6/26/2012 1:37:00 PM
Using the VirtualData property I have been able to get VsFlexGrid to
load even a large recordset (80,000 rows) very quickly with DataMode
set to flexDMBound.
Now I have added one field, DX_Checkbox, to the mdb. It is a Boolean
field (True/False, default false). According to the VsFlexGrid docs
this automatically makes the grid display such a field as a checkbox.
This is indeed the case, but as soon as I include the checkbox field
in the query, the grid no longer loads quickly. It's now as slow as a
snail. If I temporarily remove the checkbox field from the query, it's
fast again.
Anybody got any ideas why? I've tried Googling, but there are so many
questions and answers on this ActiveX control, I'll be browsing for
weeks to cover them all.
The table BTW contains 13 fields, the last one being the newly added
Boolean field. I don't select all the fields for constructing the
recordset, so the SQL looks like this:
With the Boolean field:
=====================
SQL = "SELECT DX_Checkbox, DX_MsgNum As [Article Number], DX_Subject
As Subject, " _
& "DX_From As Author, DX_Date As [Date Posted], DX_MsgID As
[Message ID] FROM Data"
Without the Boolean field (as it was originally, before the Boolean
field was added to the table)
========================
SQL = "SELECT DX_MsgNum As [Article Number], DX_Subject As Subject, "
_
& "DX_From As Author, DX_Date As [Date Posted], DX_MsgID As
[Message ID] FROM Data"
Here is how I open the ADODB recordset:
rs.Open SQL, Conn, adOpenDynamic, adLockOptimistic, adAsyncFetch
NB: adAsyncFetch doesn't seem to make any difference. I thought it did
originally, but now the grid loads fast with or without adAsyncFetch,
provided the Boolean field isn't included, and it loads slowly with or
without adAsyncFetch, if the Boolean field IS included.
The grid's salient properties are set as follows:
..DataMode = flexDMBound
..Editable = flexEDKbdMouse
..ScrollTrack = True
..VirtualData = True
I'm switching off Redraw before binding the recordset, i.e.:
With vsFlexHeaders
.Redraw = flexRDNone
Set .DataSource = rs
.Redraw = True
End With
So I don't know what else to try to get my speed back!
If merely adding a Boolean field slows down the loading to such an
extent it's a real showstopper. But what is so special about a Boolean
field in an mdb?
MM