Access Dsum function help

N

Nate

I have been having trouble breaking this function for my query. I have 2
columns, date and amount. I need to sum the amount for one year for day one.
I then need to add to this total each day going forward, with the amount from
one year forward. I keep getting an error message in each line, not sure if
it is syntax errors.
I will post the function code below:

OneYrOut: DSum("[amount]","[OneYearOut]","[O/N Date]>=#" & [O/N Date] & "#
AND [O/N Date]<#" & DateSerial(Year([O/N Date])+1,Month([O/N Date]),Day([O/N
Date]) & "#"))

Any help is greatly appreciated- thanks
 
K

Klatuu

Your problem is cause by bad naming conventions and lack of object
qualification.
The best rule for naming is - Use only Letters, Digits, and the underscore _
Spaces and special characters are problematic.
It looks like you have a field in your table name [O/N Date] and a control
on your form with the same name. (This is a gem, it violates every naming
convention. Spaces, special characters, and using a reserved word - Date)

You are confusing Jet with ambiguity. Qualify your ojbects:
Table field -> MyTableName.[O/N Date]
Form control -> Forms!MyFormName![O/N Date]

I suggest you visit this site:
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnaraccess/html/msdn_20naming.asp
 
Top