I have this code:
DM.OnUpdate="CalculDiferenta"
DM.OnInsert="CalculDiferenta"
Sub CalculDiferenta
If Dsrid.Value=50000 Then
stl.first
Do While Not Stl.Eof
Diferenta.Value=Cantv.Value-Cantc.Value
Stl.Next
Loop
end if
End Sub
It calculates the difference between 2 Quantity columns in a document. Now, i want to be alerted if there is any difference (Cantv.Value-Cantc.Value <> 0 ). The code should check every line of the document for any differences and when it finds the first one, stop and show msgbox.
I did this, but i'm not sure it's ok. It show's a pop up just when the last line has a difference.
DM.OnUpdate="VerificareDiferente"
DM.OnInsert="VerificareDiferente"
Public Sub VerificareDiferente
If Dsrid.value=50000 and Cantv.Value-Cantc.Value <> 0 then
stl.first
Do While Not Stl.Eof
MsgBox "Exista diferente intre cantitate comandata si cantitate verificata.", vbInformation, "Atentie !!!"
Stl.Next
Loop
end if
End Sub
Could you help me guys ? Thank you.