I have a report that i use code to calculate different fields. I want to change the code to accept user dates instead of using static dates. Below is an example of how it is currently.
DTotal.Value = DSum("[D]", "log", "[TYPE] = 3 AND Date >= #5/1/2008# AND Date <= #4/30/2009#")
I tried to change it to this (I know that the dates are still static but i just want to get the variables to work correctly first) ...
Dim StartDate, EndDate As Date
StartDate = #5/1/2008#
EndDate = #4/30/2009#
DTotal.Value = DSum("[D]", "log", "[TYPE] = 3 AND Date >= " & StartDate & " AND Date <= " & EndDate)
When i run it like this, it returns a blank (or null i guess) value. Can anyone tell me what i am doing wrong?
Thanks,
Chester64
DTotal.Value = DSum("[D]", "log", "[TYPE] = 3 AND Date >= #5/1/2008# AND Date <= #4/30/2009#")
I tried to change it to this (I know that the dates are still static but i just want to get the variables to work correctly first) ...
Dim StartDate, EndDate As Date
StartDate = #5/1/2008#
EndDate = #4/30/2009#
DTotal.Value = DSum("[D]", "log", "[TYPE] = 3 AND Date >= " & StartDate & " AND Date <= " & EndDate)
When i run it like this, it returns a blank (or null i guess) value. Can anyone tell me what i am doing wrong?
Thanks,
Chester64
Comment