Multiple Tables and DSum() function (1 Viewer)

warpathmechanic

Registered User.
Local time
Yesterday, 19:32
Joined
Aug 30, 2011
Messages
11
I have searched here and on Google and just about everywhere else but it seems that I cannot solve this problem:

I have two tables [Sends] and [Sales Data]

One has a date field [Sent Date].[Sends] formatted as "Date/Time" (ex. 01/01/2012)

One has Payment Data [Sales Data].[Payment] formatted as "Currency"

I need to do a running total of Payment based on grouping the month/year of the [Sent Date].[Sends] field. So it should look like (pending word wrap doesn't mess it up):

7/2009 5
7/2009 10
8/2009 6
8/2009 9
8/2009 15

etc.

I had a calculated field that gave me the Month/Year combination in the table [Sends] so my DSum looked like:

Code:
DSum("Payment","Sales Data","MonthYear =" & [MonthYear] & " And Sends.MonthYear <=" & [MonthYear])

but it kept telling me it could not find the parameter 'MonthYear'

Assistance is desperately needed!

Thank you knowledge centers of Access,

Warpath
 

gbnz

Registered User.
Local time
Yesterday, 21:32
Joined
Mar 12, 2010
Messages
63
I don't know if this helps but I do know that when you are using dates in a query you have to have the # symbol on each side of the date.
 

warpathmechanic

Registered User.
Local time
Yesterday, 19:32
Joined
Aug 30, 2011
Messages
11
I don't know if this helps but I do know that when you are using dates in a query you have to have the # symbol on each side of the date.

I haven't tried it but I certainly will. My biggest problem is the syntax for pulling from two different tables. Other problems include:

  • Pulling the month and year from a field formatted 01/01/1900 in the DSum formula
  • Formatting Currency
  • and the syntax of the formula. I have worked with Access and SQL for a while now but this is the first time I have worked with this or any of the other D* formulas
 

gbnz

Registered User.
Local time
Yesterday, 21:32
Joined
Mar 12, 2010
Messages
63
Code:
DSum("[B]Payment[/B]","Sales Data","[B]MonthYear [/B]=" & [MonthYear] & " And Sends.MonthYear <=" & [MonthYear])
Also I know that I have had issues with the items above that are bold not being in square brackets []

Just remember field names in brackets & quotes...tables and queries just quotes. :)
 

Users who are viewing this thread

Top Bottom