MartyH
2022-07-11T17:03:45Z
Hi,
I am new to iGrid... so you'll need to go slowwwwwly!!!

I have 3 questions:
1) As you may see in Fig 1 I have two "Header Columns" but I cannot get the second header to "freeze" (similar to first 3 columns). Can I do this? ie stop the Month going up and being hidden.
2) Is there something that I can do about the repeating numbers in the second column header? eg I would like to just print "July" once across top.
3) Similar to the 1st question -- is there any way that I could get the "sort option" to work WITHOUT the first rows?
4) Is there anything that I could do to speed up the code : eg Virtual

iGrid02.JPG

Click to View Image50 View(s)



I have copied the code (except for the SQL) in the following snippet:
Private Sub Form_Load()
Dim rs As ADODB.Recordset
Dim i As Long
Dim j As Variant
Dim Start As Long

' This allows us to use IntelliSense below
Dim grd As iGrid
Set grd = iGrid1.Object

grd.FrozenCols = 3
grd.FrozenColsEdgeColor = vbRed
j = 0


   ' Create the column structure - we'll use a subset of all the fields in the table.
   ' The keys of the columns are field names.
   With grd
      .DrawRowText = True
      
      .AddCol sKey:="SerNo", sHeader:="Project No."
      .AddCol(sKey:="nrcan projectstartdate", sHeader:="Start Date", lWidth:=190).sFmtString = "dddd, mmm d yyyy"
      .AddCol(sKey:="nrcan projectenddate", sHeader:="End Date", lWidth:=190).sFmtString = "dddd, mmm d yyyy"
      For i = 4 To 368
        .AddCol sKey:=i - 3, sHeader:=DateAdd("d", CStr(i - 4), m1stDate)
      Next
      .AddRow 'vRowParent:="SerNo"
      For i = 4 To 368
        .CellValue(1, i) = Month(DateAdd("d", CStr(i - 4), m1stDate))
      Next     
     .RowHeight(1) = 40

   End With
    
   ' Here we populate iGrid using our column structure
   Set rs = CurrentProject.Connection.Execute("SELECT * FROM xtblPCSPCaseFile") ' or even simply use "Customers" instead of the SQL query
   grd.FillFromRS rs, EMode:=igFillRSAddToExistingRows, vRowKeyField:="SerNo"

   For j = 1 To grd.RowCount - 1
    Start = modScreen.Get1stDateDiff(CDate(grd.CellValue(j + 1, 2))) + 4
    grd.CellValue(j + 1, Start) = "S"
    grd.CellBackColor(j + 1, Start) = RGB(255, 0, 0)
   Next


   ' Automatically enlarge columns to show cell contents without clipping
   grd.AutoWidthCols



End Sub


Marty H.
President
mhHawk Computing Corp.