Select SUM query question

jnh

Registered User.
Local time
Today, 14:42
Joined
Jan 2, 2012
Messages
31
Hi,

Trying to SUM all records where first 3 characters of Company = DMV. Have tried all kinds of () but always get the Enter Parameter... prompt.
What am I missing on query?
DMV: Sum((IIf([left$(Company,3)]="DMV",[AMOUNT],Null)))

Your help is greatly appreciated.

A Healthy and Happy 2016 to You and Yours...jnh
 
I would use a query.

SELECT Sum([Amount])
FROM tablename
WHERE Left(Company,3)="DMV"
 
Sorry that does not appear to work.

The query resets to the original coding which is actually is the same (as detailed below) but which does NOT test for 1st 3 characters being DMV.
Please note that this Select statement is one of about 10+ and they all give
proper replies but I have to check the first 3 characters to get proper DMV answer (it covers a wide variety of vehicles).


DMV: Sum((IIf([Company]="DMV",[AMOUNT],Null)))

Another one that works fine (NO position test is needed)

HOA: Sum((IIf([Company]="HOA",[AMOUNT],Null)))

Any way you can modify the original to test left 3 characters?
 
DMV: Sum(IIf(left$([Company],3)="DMV",[AMOUNT],Null))
 

Users who are viewing this thread

Back
Top Bottom