Postada em 06/10/2008 16:45 hs
Pessoal me ajude a arrumar esse código!! Tá carregando a figura normalmente o problema esta sendo o calculo da data.
A coluna 7 do FlexGrid esta com a data 05/12/2008 a data de hoje 06/10/2008, deveria carregar a figura verde.gif mas tá carregando o vermelho.gif. Acho que não estou sabendo é posicionar corretamente esse codigo de comparação das datas. Alguem tem uma sugestão?
Public Sub PreencheGrid() Dim Row As Integer Dim i, z Dim Y Dim a, b, c, d Set RS = New ADODB.Recordset With RS .CursorType = adOpenStatic .CursorLocation = adUseClient .LockType = adLockPessimistic .Source = "SELECT DataEmissao,NumeroNota,RazaoSocial,RazaoSocial2,NaturezaOP,PrazoRetorno,DataRetorno,Items,Solicitante,Contrato,Codigo FROM Cabecalho " .ActiveConnection = Cnn .Open If .BOF = True And .EOF = True Then Exit Sub Grid.Rows = .RecordCount + 1 Do Until .EOF = True Row = Row + 1 Grid.Col = 0 Grid.Row = Row For i = 0 To RS.Fields.Count - 1 Select Case i Case 7 ' considerando a coluna vencimento FechaA = Format(RS(i).Value, "dd/mm/yy") FechaB = Format(Now, "dd-mm-yy") If FechaB >= FechaA Then Set Grid.CellPicture = FrmPicture.Vermelho.Picture Grid.CellPictureAlignment = 4 'CenterCenter Else Set Grid.CellPicture = FrmPicture.Verde.Picture Grid.CellPictureAlignment = 4 'CenterCenter End If End Select Next i Grid.TextMatrix(Row, 1) = !NumeroNota Grid.TextMatrix(Row, 2) = !DataEmissao Grid.TextMatrix(Row, 3) = !RazaoSocial Grid.TextMatrix(Row, 4) = !RazaoSocial2 Grid.TextMatrix(Row, 5) = !NaturezaOP Grid.TextMatrix(Row, 6) = !PrazoRetorno Grid.TextMatrix(Row, 7) = !DataRetorno Grid.TextMatrix(Row, 9) = !Items Grid.TextMatrix(Row, 13) = !Solicitante Grid.TextMatrix(Row, 14) = !Contrato Grid.TextMatrix(Row, 15) = !Codigo .MoveNext Loop End With End Sub
|