I have new procedures to reproduce the problem. It seems it's not related specifically to the form Selection Cheques because today we got the problem after the calculation has been done without calling the form selection chèques.
So the trick with Echo.false-true doesn't seem to help. I tried to input the recordsource through openargs instead of using filter, we'll see.
So, I think the problem must resides inside that chunk of code:
Code:
Public Sub calculer()
Dim chequeTotal As Double
MsgBox "Calcul"
'DoCmd.RefreshRecord
Forms![livretDepot]![subChequesEncaisses].Requery
'DoCmd.RunCommand acCmdSaveRecord
If Me.Dirty = True Then Me.Dirty = False 'remplace acCmdSaveRecord
'MsgBox DCount("montant", "chequesEncaisses", "livretId =" & Me.[idCtl] & "")
If DCount("montant", "chequesEncaisses", "livretId =" & Me.[idCtl] & "") = 0 Then
'MsgBox "nothing"
chequeTotal = 0
Else
chequeTotal = Nz(subChequesEncaisses![totalCheques], 0)
End If
totalEspeces = Nz([5] + [10] + [20] + [50] + [100] + [sous] + Nz([sous2], 0), 0)
'MsgBox chequeTotal
montant = chequeTotal + totalEspeces
'DoCmd.RefreshRecord
If aDeposer < 0 Then
MsgBox "Attention, il n'y a pas assez de comptant à déposer. Veuillez diminuer le montant d'espèces à déposer."
End If
End Sub