不同VBA警報我有這樣的代碼:當結果是由0
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
它計算在文檔中的2點數量的列之間的差異。 現在,我想要提醒,如果有任何區別(Cantv.Value-Cantc.Value <> 0)。代碼應該檢查文檔的每一行是否有差異,當它找到第一個時,停止並顯示msgbox。
我這樣做了,但我不確定沒關係。當最後一行有差異時,它顯示出彈出。
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
你能幫助我嗎?謝謝。
考慮編輯代碼塊的清晰度。我懷疑if和while語句的順序有錯誤。 – putonspectacles