Stumped - DSUM Error

bstice

Registered User.
Local time
Today, 05:34
Joined
Jul 16, 2008
Messages
55
Alright, this one has me stumped. I have the following code.

Me.Orders = DSum("['" & AccountingPeriod & "']", "PLMaster", "[Type] = 'Orders PS' And [Area] = '" & AreaDetail & "' And [PLtype] = 'Actual'")

It worked for the very first value of AccountingPeriod, which is 200801, but it doesn't work any other value. I keep getting the runtime error 2001, which is that I have cancelled a previous operation.

Its a pretty simple dsum code. The only "crazy" stuff is that I try to dynamically change the AccountingPeriod variable. Thanks for help and I always give out reputation points for help. Thanks

Brennan
 
The first argument within the DSum function should be the Table Column you want to Sum...not the Accounting Period. The Accounting Period should be placed within the WHERE clause of the DSum function.

Me.Orders = DSum("[TotalsColumnFieldInTable]", "PLMaster", "[Type] = 'Orders PS' And [Area] = '" & AreaDetail & "' And [PLtype] = 'Actual' AND [AccountingPeriodFieldInTable] =" & AccountingPeriod)


.
 

Users who are viewing this thread

Back
Top Bottom