S
StuJol
i cant get my head round what is happening, please can anyone help?
i have the following 3 functions to work out a sum within a year
Function OurStartDate() As Date
OurStartDate = DLookup("[OurStartDate]", "tblOurCompanyInfo")
End Function
Function OurEndDate() As Date
OurEndDate = DLookup("[OurEndDate]", "tblOurCompanyInfo")
End Function
Function CurrentFiscalYear() As String
CurrentFiscalYear = DSum("[TotalPriceIncludingVAT]", "tblExpenses",
"[ExpensesDate] >= # " & OurStartDate() & " # and [ExpensesDate] <= # " &
OurEndDate() & " #")
End Function
When i type the function ?CurrentFiscalYear into the intermediate window it
returns a value which is correct. All is good
i have the following 3 functions to work out a sum within a week
Function CurrentWeekFromDate() As Date
CurrentWeekFromDate = DateAdd("d", (Weekday(Date) * -1) + 2, Date)
End Function
Function CurrentWeekToDate() As Date
CurrentWeekToDate = DateAdd("d", 6 - Weekday(Date), Date)
End Function
Function CurrentWeek() As String
CurrentWeek = DSum("[TotalPriceIncludingVAT]", "tblExpenses",
"[ExpensesDate] >= # " & CurrentWeekFromDate() & " # and [ExpensesDate] <= #
" & CurrentWeekToDate() & " #")
End Function
both set of functions are the same but the last function CurrentWeek returns
Runtime Error 94 Invalid use of NULL
CurrentWeekFromDate=12/02/2007
CurrentWeekToDate=16/02/2007
The Dsum function should return a value not NULL
i have the following 3 functions to work out a sum within a year
Function OurStartDate() As Date
OurStartDate = DLookup("[OurStartDate]", "tblOurCompanyInfo")
End Function
Function OurEndDate() As Date
OurEndDate = DLookup("[OurEndDate]", "tblOurCompanyInfo")
End Function
Function CurrentFiscalYear() As String
CurrentFiscalYear = DSum("[TotalPriceIncludingVAT]", "tblExpenses",
"[ExpensesDate] >= # " & OurStartDate() & " # and [ExpensesDate] <= # " &
OurEndDate() & " #")
End Function
When i type the function ?CurrentFiscalYear into the intermediate window it
returns a value which is correct. All is good
i have the following 3 functions to work out a sum within a week
Function CurrentWeekFromDate() As Date
CurrentWeekFromDate = DateAdd("d", (Weekday(Date) * -1) + 2, Date)
End Function
Function CurrentWeekToDate() As Date
CurrentWeekToDate = DateAdd("d", 6 - Weekday(Date), Date)
End Function
Function CurrentWeek() As String
CurrentWeek = DSum("[TotalPriceIncludingVAT]", "tblExpenses",
"[ExpensesDate] >= # " & CurrentWeekFromDate() & " # and [ExpensesDate] <= #
" & CurrentWeekToDate() & " #")
End Function
both set of functions are the same but the last function CurrentWeek returns
Runtime Error 94 Invalid use of NULL
CurrentWeekFromDate=12/02/2007
CurrentWeekToDate=16/02/2007
The Dsum function should return a value not NULL