still cant reomve blanks from an array
i have this code that creates an array which writes to a grid.When it populates the gris there are blanks in between the totals(these are the records that make up the totals)
I need to shuffle the grid or array up to remove the blanks....
aryProductWasteDetails.ReDim 0,recordset.RecordCount - 1, 0, 3
aryProductWasteDetails2.ReDim 0, 3, 0, 3
intloop = 0
Do While rstwastedetailsbylineproducttypearea.EOF = False
' If IsNull(rstwastedetailsbylineproducttypearea!wastetypeid) Then wastetypeid = "" Else wastetypeid = RTrim(rstwastedetailsbylineproducttypearea!wastetypeid)
If IsNull(rstwastedetailsbylineproducttypearea!ProductID) Then ProductID = "" Else ProductID = RTrim(rstwastedetailsbylineproducttypearea!ProductID)
If IsNull(rstwastedetailsbylineproducttypearea!ProductName) Then ProductName = "" Else ProductName = RTrim(rstwastedetailsbylineproducttypearea!ProductName)
If IsNull(rstwastedetailsbylineproducttypearea!kgs) Then kgs = "" Else kgs = RTrim(rstwastedetailsbylineproducttypearea!kgs)
rstwastedetailsbylineproducttypearea.MoveNext
If rstwastedetailsbylineproducttypearea.EOF = True Then
TotalProductWaste = TotalProductWaste + kgs
aryProductWasteDetails(intloop, 0) = ProductID
aryProductWasteDetails(intloop, 1) = ProductName
aryProductWasteDetails(intloop, 2) = TotalProductWaste
Else
If RTrim(rstwastedetailsbylineproducttypearea!ProductName) = ProductName Then
TotalProductWaste = TotalProductWaste + kgs
Else
aryProductWasteDetails(intloop, 0) = ProductID
aryProductWasteDetails(intloop, 1) = ProductName
TotalProductWaste = TotalProductWaste + kgs
aryProductWasteDetails(intloop, 2) = TotalProductWaste
TotalProductWaste = 0
End If
End If
intloop = intloop + 1
Loop
For r = 0 To aryProductWasteDetails.UpperBound(1)
If aryProductWasteDetails(r, 1) <> "" Then
aryProductWasteDetails2(r, 0) = aryProductWasteDetails(r, 0)
aryProductWasteDetails2(r, 1) = aryProductWasteDetails(r, 1)
aryProductWasteDetails2(r, 2) = aryProductWasteDetails(r, 2)
End If
Next r
TDBGrid1.Array = aryProductWasteDetails
TDBGrid1.ReBind
TotalProductWaste = 0