Thanks,Flair.

However,I encounter another problems then.I will display out all the model and total quantity in the datagrid by two columns.When the total quantity is less than the set TargetQty,it will display out vbRed and if the total quantity meet the TargetQty,it will display vbGreen.To get the Total quantity,Qty should add the Exceed Packout for that day as shown in the code below so that it can compared with the TargetQty.But,dunno why some of the data should be green,but it turns to Red because it doesn't add up my Qty.

Maybe my explanation is not good enough.Below attached is the coding that I do.Hope anyone here can solve the problem for me.Thank You.

VB Code:
  1. Private Sub DisplayGrid ()
  2. .....
  3.  
  4. fg.Clear
  5. sSQL = "SELECT * FROM PackQty_View"
  6. Set oRs1 = oShip.Execute(sSQL)
  7. 'Run FROM PackQty_View and get ModelDefined(Ex:- I730 and I90) and Qty by 2 and 11
  8.  
  9.   Do Until oRs1.EOF
  10.    
  11.         fg.Rows = oRs1.RecordCount + 1
  12.         fg.TextMatrix(Row, 1) = oRs1!Qty
  13.         Qty = oRs1!Qty
  14.         ModelDefined = oRs1!ModelDefined
  15.         oRs1.MoveNext
  16.     Loop
  17.  
  18. DisplaySQL = "SELECT Model,TargetQty,Exceed FROM DataGrid"
  19. Set rst = oSQL.Execute(DisplaySQL)
  20.  
  21.     fg.ColWidth(0) = 2900
  22.     fg.ColWidth(1) = 1600
  23.    
  24.     fg.ColAlignment(0) = flexAlignLeftCenter
  25.     fg.ColAlignment(1) = flexAlignLeftCenter
  26.  
  27.     Row = 0
  28.    
  29.     fg.TextMatrix(Row, 0) = "Model"
  30.     fg.TextMatrix(Row, 1) = "Total Quantity"
  31.    
  32.     Row = Row + 1
  33.    
  34. Do Until rst.EOF
  35.    
  36.         fg.Rows = rst.RecordCount + 1
  37.         fg.TextMatrix(Row, 0) = rst!Model
  38.  
  39.         DisplaySQL = "SELECT * FROM DataGrid"
  40.         Set rst = oSQL.Execute(DisplaySQL)
  41.        
  42.         If fg.TextMatrix(Row, 0) <> oRs1!ModelDefined Then  'Izit i compare like this make it compare only with the Model in the first row in PackQty_View instead of comparing with the second row?
  43.                 Qty = 0
  44.             Else
  45.                 fg.TextMatrix(Row, 1) = oRs1!Qty
  46.                 Qty = oRs1!Qty
  47.                 oRs1.MoveNext
  48.             End If
  49.  
  50.         TargetQty = rst!TargetQty
  51.         Exceed = rst!Exceed
  52.         sTotal = Qty + Exceed
  53.    
  54.         fg.TextMatrix(Row, 1) = sTotal
  55.  
  56.         If fg.TextMatrix(Row, 1) < TargetQty Then
  57.          fg.Row = Row
  58.          fg.Col = 1
  59.          fg.CellBackColor = vbRed
  60.  
  61.         ElseIf fg.TextMatrix(Row, 1) >= TargetQty Then
  62.          fg.Row = Row
  63.          fg.Col = 1
  64.          fg.CellBackColor = vbGreen
  65.         End If
  66.  
  67.         Row = Row + 1
  68.         rst.MoveNext
  69.  
  70.  
  71.     Loop
  72.  
  73. Exit Sub
  74.  
  75. End Sub