I am using an MSHFlexgrid to view the contents of an MS Access Database table. The Table has 3 fields and about 5000 records. All records must be loaded, so I am forces to load it as follows:This is obviously very slow to load. Is there a way of speeding up this process?Code:SetConnection Set RSProd = New ADODB.Recordset RSProd.Open "SELECT * FROM TblProdMast ORDER BY ProdNo", Conn, adOpenStatic, adLockOptimistic With grdProdMast .Clear .ClearStructure .Cols = 4 .ColWidth(0) = 500 .ColWidth(1) = 2500 .ColWidth(2) = 4000 .ColWidth(3) = 1000 .Rows = 0 GCont = "" For RCount = 0 To RSProd.Fields.Count - 1 If GCont = "" Then GCont = vbTab & RSProd.Fields(RCount).Name Else GCont = GCont & vbTab & RSProd.Fields(RCount).Name End If Next .AddItem GCont If RSProd.RecordCount > 0 Then Do Until RSProd.EOF GCont = "" For RCount = 0 To RSProd.Fields.Count - 1 If GCont = "" Then GCont = vbTab & RSProd.Fields(RCount) Else GCont = GCont & vbTab & RSProd.Fields(RCount) End If Next .AddItem GCont RSProd.MoveNext Loop Else .AddItem "" End If RSProd.Close .FixedCols = 1 .FixedRows = 1 .ColAlignment(1) = flexAlignLeftCenter .ColAlignment(2) = flexAlignLeftCenter .ColAlignment(3) = flexAlignLeftCenter Set RSProd = Nothing CloseConnection End With




Reply With Quote