Dsum

aussiehedge

Registered User.
Local time
Today, 17:25
Joined
Nov 24, 2006
Messages
10
i have a query called "Total charges for mode count" with 3 columns

SumOfPackages, Port Of Loading, Mode

In a report i am trying to lookup from this query that is not bound to the report and add the total number of packages. The report contains two groups Port of loading and mode.

The lookup will first need to determine the port then the mode to give the correct total.

=DSum("[SumOfPackages]","Total Charges For mode count","[Port Of Loading] = '" & Reports!Test3![Port Of Loading] & "[Mode]= '" & Reports!Test3!MODE & "'")

Any help would be great!
 
If you visualize what your concatenation would produce, it might be:

"[Port Of Loading] = '123[Mode]= 'abc'"

So there are 2 big errors. First, around the [port of loading] value, you have a single quote before the value but not after. You either want both or neither, depending on whether the field is text or numeric. Secondly, you haven't separated the 2 tests with either AND or OR, as appropriate.
 
=DSum("[SumOfPackages]","Total Charges For mode count","[Port Of Loading] = " & Reports!Test3![Port Of Loading] And "[Mode]=" & Reports!Test3!MODE & "'")

Tried this, still not working the port of loading and the mode are both text fields.

Entered and between them as it should match both.
 
Look carefully at your concatenation, which must join literal strings with report references. Yours is off. Plus you've again mixed single quote with no single quote. If both are text fields, single quotes must surround both values.
 

Users who are viewing this thread

Back
Top Bottom