|
8#
楼主 |
发表于 2010-3-4 15:03:38
|
只看该作者
2. 100条左右没问题,到3000条左右需要10秒钟,这样就不切实际了,下面的代码是从示例中(FlexGrid_Demo)截取的,主要是慢在需要一个一个的循环行和列去填充
示例中的数据本来是10条,我加到3000条再测,速度就比较慢了:
Set RST = CurrentDb.OpenRecordset("SELECT * FROM qryProjects") 'make list of Projects
mRowCount = 2 'set initial (non-fixed) row counter
Do Until RST.EOF 'step thru recordset
flxgrd.AddItem RST!ProjectID & vbTab _
& " " & RST!ProjectName & vbTab _
& Format(RST!StartDate, "Short Date") & vbTab _
& Format(RST!EndDate, "Short Date") & vbTab _
& RST!ResourceID 'and add each Project record to list
SelectRange flxgrd, mRowCount, 1, mRowCount, 4 'show Project rows in Bold (Cols 1-4 only)
flxgrd.CellFontBold = True
ProgressLine flxgrd, vPath & "PurpleLine.bmp", vBeginDate, RST!StartDate, RST!EndDate 'draw line on grid (if any)
mRowCount = mRowCount + 1 'inc Row counter
flxgrd.Col = 1 'set Col No for +/-/x sign
If DCount("ID", "tblProjectTasks", "ProjectID = " & RST!ProjectID) > 0 Then 'if this Project has 1 or more Task records then
If InStr(1, mExpand, "." & RST!ProjectID & ".") > 0 Then 'if this .ProjectID. is in expand string then
Set flxgrd.CellPicture = LoadPicture(vPath & "Minus Sign.bmp") 'copy - image to Project rows (Col 1)
ShowTasks flxgrd, RST!ProjectID, vPath, vBeginDate 'show Tasks for this Project
Else
Set flxgrd.CellPicture = LoadPicture(vPath & "Plus Sign.bmp") 'copy + image to Project rows (Col 1)
End If
Else
Set flxgrd.CellPicture = LoadPicture(vPath & "Cross Sign.bmp") 'copy x image to Project row if no Tasks data
End If
RST.MoveNext 'move to next Order record
Loop
RST.Close
Set RST = Nothing |
|