Sumif in Access

I am trying to use the following sumiff in the Field section of the design platform for a query. I am using:

949 Office: Sum(IIf([Customer Info Table.Office]="949 S. Orange County",[ExtendedPrice],0))

It is coming back with "Data Type mistmatch"

Any idea how I can change it? I want it to add any fields with "949 S. Orange County" as the Office value.
cansevinAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)Commented:
try

949 Office: Sum(IIf([Customer Info Table].[Office]="949 S. Orange County",[ExtendedPrice],0))
cansevinAuthor Commented:
Same... Data Type mismatch.

Any other ideas? Thanks for you help, very much appreciate it.
cansevinAuthor Commented:
The ExtendedPrice field is from the query "Booking Details Extended"

Not sure if that is relevant.
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

Rey Obrero (Capricorn1)Commented:
can you upload a copy of the db with the table "Customer Info Table"

what is the data type of field "ExtendedPrice" ?
Rey Obrero (Capricorn1)Commented:
oh it is very relevant..

is the query  "Booking Details Extended" included in your query?
cansevinAuthor Commented:
I'd rather not upload anything if possible. The ExtendedPrice comes from a field with:

ExtendedPrice: CCur([Booking Details Table].[ItemPrice]*[Quantity]*(1-[Discount]))

So it is currency I believe.
cansevinAuthor Commented:
Yes it is included... the current sql is:

SELECT Sum(Format([Bookings.DateRecorded],"ww")) AS Week, Sum(IIf([Customer Info Table].[Office]="949 S. Orange County",[ExtendedPrice],0)) AS [949 Office]
FROM [Customer Info Table] INNER JOIN (Bookings INNER JOIN [Booking Details Extended] ON Bookings.BookNumber = [Booking Details Extended].BookNumber) ON ([Booking Details Extended].CustomerID = [Customer Info Table].CustomerID) AND ([Customer Info Table].CustomerID = Bookings.CustomerID);

Open in new window

Rey Obrero (Capricorn1)Commented:
try this

SELECT Sum(Format([Bookings.DateRecorded],"ww")) AS Week, Sum(IIf([Customer Info Table].[Office]="949 S. Orange County",[Booking Details Extended].[ExtendedPrice],0)) AS [949 Office]
FROM [Customer Info Table] INNER JOIN (Bookings INNER JOIN [Booking Details Extended] ON Bookings.BookNumber = [Booking Details Extended].BookNumber) ON ([Booking Details Extended].CustomerID = [Customer Info Table].CustomerID) AND ([Customer Info Table].CustomerID = Bookings.CustomerID);
cansevinAuthor Commented:
Still same... data type mismatch.
PatHartmanCommented:
Is Office really a text field or is it an ID that you think is text due to using a table level lookup?
cansevinAuthor Commented:
Thanks Pat... I am pretty sure it is a text field.

I just went back into the table it is from and it is listed as Data Type: Text.
Dale FyeOwner, Developing Solutions LLCCommented:
My guess is that the [Office] field is setup as a "lookup" in table design.  What is actually stored in the table is numeric, but what is viewed is the text associated with the office.
cansevinAuthor Commented:
Thanks Dale... how can I check that and/or fix it?
Rey Obrero (Capricorn1)Commented:
run this query

Select IIf([Customer Info Table].[Office]="949 S. Orange County","Yes","NO") AS [949 Office]
FROM [Customer Info Table]

see if you get the same error.
cansevinAuthor Commented:
That came back with no error. Ran properly. Does this mean the problem is in the Extended Price?
PatHartmanCommented:
Can you sum the Extended price without embedding it in the IIf()?
Rey Obrero (Capricorn1)Commented:
run your query [Booking Details Extended]
see if all records have correct values on field "ExtendedPrice"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cansevinAuthor Commented:
Thanks Ray... that did it! Fixed some data in Extended price. Now it works. Much appreciated!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.