Caro Rodoufo, um colega meu já me deu a dica do somatório em uma grade num formulario de UM PARA N.
Tabela pai: LICITAÇÃO.DBF
tabela filho: CONTRATO.DBF
compo de relacionamento: LICITA_ID
O código ficou assim: (o código tem que estar dentro da GRADE no procedimento REFRESH)
Local lcOldAlias,;
lnOldRecNo,;
lnTotal
m.lnTotal= 0
m.lcOldAlias= Alias()
Select Contrato
m.lnOldRecNo= IIf( EoF(), 0, RecNo() )
Go Top
Set Near On
=Seek( Licitacao.licita_id )
Set Near Off
Scan While licita_id == Licitacao.licita_id
m.lnTotal= m.lnTotal + valorcont
EndScan
If m.lnOldRecNo > 0
Go m.lnOldRecNo
Else
Go Top
EndIf
Select ( m.lcOldAlias )
ThisForm.TxtValorcont.Value= m.lnTotal
ThisForm.TxtValorcont.Refresh()
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only