zelarra821
Registered User.
- Local time
- Tomorrow, 00:43
- Joined
- Jan 14, 2019
- Messages
- 813
Good night from Spain. I want to subtract a field from the previous field, I don't know if I explain myself. I have this function, which works for me in another database, but for some unknown reason, it doesn't in this one.
The field to subtract (CampoARestar) is cubic meters, and I want to know the difference with the last date entered.
Thanks.
Code:
Function CalcularDiferencia(CampoARestar As String, Id As Double) As Double
Dim regAnterior As Double
If IsNull(CampoARestar) Then Exit Function
regAnterior = Nz(DMax(Replace(CampoARestar, ",", "."), "TGasControl_lecturas para calefacccion", "Id<" & Id), 0)
If regAnterior = 0 Then
CalcularDiferencia = regAnterior
Else
CalcularDiferencia = CampoARestar - regAnterior
End If
End Function
The field to subtract (CampoARestar) is cubic meters, and I want to know the difference with the last date entered.
Thanks.