Dsum issue

mjwakema

Registered User.
Local time
Today, 09:49
Joined
Nov 4, 2013
Messages
11
I would like to know if this is possible?

my report date is in 1 table and my data is in a seperate table. I would like to sum my hours from the Appleton table from a date range in the YearMonth table

Public Function CorpRIR()
Dim mySum
Dim begD As Variant
Dim endD As Variant
Dim number

begD = DLast("ReportDate", "tblYearMonth")
endD = begD - 240 ' this will be a variable latter on just hardcoded for testing

mySum = DSum("[AppletonHours]", "tblAppleton", "[tblYearMonth]![ReportDate]= between #" & begD & "# & And #" & endD & "#")
end function

Thank you
 
Not this way - your dsum criteria need to relate to the records in tblAppleton and is also written slightly incorrectly - you either use '=' or you use 'between', but not both at the same time. and you shouldn't have the '&' in "# & And #".

I cannot suggest a solution as you have not provided sufficient information, other than to say you need to have a date field in tblAppleton and you should use that field name instead of [tblYearMonth]![ReportDate]
 

Users who are viewing this thread

Back
Top Bottom