Regards
I have the attached database which calculate the Difference between dates .
I have also two problems like i shown in the image
MarkK tried to help me before with the code
But i can't do it with dates .. and in my database
Thanks ...
I have the attached database which calculate the Difference between dates .
I have also two problems like i shown in the image
MarkK tried to help me before with the code
Code:
Option Compare Database
Option Explicit
Sub Recalculate()
Dim rst As DAO.Recordset
Dim dff As Long
Dim nxt As Long
Dim ttl As Long
Dim Name As String
Dim tot As Long
Set rst = Me.RecordsetClone
With CurrentDb.OpenRecordset( _
"SELECT * FROM Table2 ORDER BY Name, Value" _
)
.MoveFirst
Do While Not .EOF
.Edit
If Name <> !Name Then
Name = !Name
ttl = !Value
!Next = Null
!Diff = Null
!Total = Null
Else
!Next = nxt
!Diff = !Value - nxt
ttl = ttl + !Value
!Total = ttl
End If
.Update
nxt = !Value
.MoveNext
Loop
.Close
End With
Me.Recordset.Requery
End Sub
Private Sub Form_Load()
Recalculate
End Sub
But i can't do it with dates .. and in my database
Thanks ...