DSum Syntax Problem

Geoff Codd

Registered User.
Local time
Today, 07:45
Joined
Mar 6, 2002
Messages
190
I have the following query

SELECT [Central_Budget_Utilities_Data_(Present)_Grouped_(Temp)].Utility_Type, [Central_Budget_Utilities_Data_(Present)_Grouped_(Temp)].Period, [Central_Budget_Utilities_Data_(Present)_Grouped_(Temp)].SumOfCost, Val(DSum("[SumOfCost]","Central_Budget_Utilities_Data_(Present)_Grouped_(Temp)","[Utility_Type] = '" & [Utility_Type] & "' And [Period] <= #" & [Period] & "#")) AS RunningSum
FROM [Central_Budget_Utilities_Data_(Present)_Grouped_(Temp)];

For some reason it won't work, I'm sure that it has something to do with the date part of the equation, I'm probably using the wrong syntax

Field SumOfCost is Number Format
Field Utility_Type is Text Format
Field Period is Date Format

Any help with this would be most appreciated

Thanks
Geoff
 
It seems you have included a leading space in the query/table name in DSum():-

Val(DSum("[SumOfCost]"," Central_Budget_Utilities_Data_(Present)_Grouped_(Temp)","[Utility_Type] = '" & [Utility_Type] & "' And [Period] <= #" & [Period] & "#")) AS RunningSum
 

Users who are viewing this thread

Back
Top Bottom