I have read a few post on here however they have not helped, I personally think I am missing something while using Dsum() function. as you can see the code below, the expression and table names are correct I think I just have the incorrect statement to search between dates- AND yes I am in the UK so the date format(dd/mmm/yyyy). The result for the Dsum function below is Null.
The idea is to have a running total of income as you would see in a bank statement.
Code:
Dim GrossIncome As Double
Dim TodayDate, ToDate As Date
TodayDate = Date()
ToDate = Me.ToDate
GrossIncome = Me.GrossIncome
If IsNull(GrossIncome) Then
GrossIncome = DSum("[Amount]", "Income/Expense", "[ToDate] > #06/04/2015#" & " AND [ToDate]< #" & TodayDate & "#")
Me.GrossIncome = GrossIncome
End If
I have used this function:
Code:
DSum("[Amount]", "Income/Expense", "[ToDate] > #06/04/2015#" & " AND [ToDate]< # 05/04/2016 # ")
and it gives me the whole total between the dates. This is why I think I have the incorrect statement when dealing with the Todaydate Variable or the date() function.
Code:
GrossIncome = DSum("[Amount]", "Income/Expense", "[ToDate] > #06/04/2015#" & " AND [ToDate]< #" & Date() & "#")
Anyone have any suggestions.