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?
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))
0
cansevinAuthor Commented:
Same... Data Type mismatch.

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

Not sure if that is relevant.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

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" ?
0
Rey Obrero (Capricorn1)Commented:
oh it is very relevant..

is the query  "Booking Details Extended" included in your query?
0
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.
0
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

0
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);
0
cansevinAuthor Commented:
Still same... data type mismatch.
0
PatHartmanCommented:
Is Office really a text field or is it an ID that you think is text due to using a table level lookup?
0
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.
0
Dale FyeCommented:
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.
0
cansevinAuthor Commented:
Thanks Dale... how can I check that and/or fix it?
0
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.
0
cansevinAuthor Commented:
That came back with no error. Ran properly. Does this mean the problem is in the Extended Price?
0
PatHartmanCommented:
Can you sum the Extended price without embedding it in the IIf()?
0
Rey Obrero (Capricorn1)Commented:
run your query [Booking Details Extended]
see if all records have correct values on field "ExtendedPrice"
0

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!
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.