cansevin
asked on
Syntax for querry
I am trying to do a sumif formula that isn't working. If the value of the Office is "949 S. Orange County" I want it to sum the data. I am using the below syntax. When I run the querry it asks me to Enter Parameter Value for Office.Customer Info Table. If I type in "949 S. Orange County" then it works properly I'd like to to look for it without asking me to enter it. Any ideas?
Sum(IIf([Office].[Customer Info Table]="949 S. Orange County",[ExtendedPrice],0) ) AS [949 Office]
Sum(IIf([Office].[Customer
What is the actual name of the Table (or Query) and the Field in the Table (or Query) ?
Maybe you should try 909 W. San Bernardino County :-)
Maybe you should try 909 W. San Bernardino County :-)
ASKER
The table name is Customer Info Table
The Field name is Office
In that field there are values that read "949 S. Orange County" I want it to sum those values. Thanks!
The Field name is Office
In that field there are values that read "949 S. Orange County" I want it to sum those values. Thanks!
Are you certain that the field [Customer Info Table] exists in the Office table? Be sure to verify the field is spelled the same way.
Ron
Ron
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes... it is there. Here is the entire syntax:
SELECT Format([Bookings.DateRecor ded],"ww") AS Week, Sum(IIf(Year([Bookings.Dat eRecorded] )=2014,[Ex tendedPric e],0)) AS [2014 Rev], Sum([Booking Details Extended].ExtendedPrice) AS SumOfExtendedPrice, [Customer Info Table].Office, Sum(IIf([Office].[Customer Info Table]="949 S. Orange County",[ExtendedPrice],0) ) AS [949 Office]
FROM [Customer Info Table] INNER JOIN ([Booking Details Extended] INNER JOIN Bookings ON [Booking Details Extended].BookNumber = Bookings.BookNumber) ON ([Booking Details Extended].CustomerID = [Customer Info Table].CustomerID) AND ([Customer Info Table].CustomerID = Bookings.CustomerID)
WHERE (((Bookings.DateRecorded) Between #1/1/2014# And #12/31/2014#))
GROUP BY Format([Bookings.DateRecor ded],"ww") , [Customer Info Table].Office;
SELECT Format([Bookings.DateRecor
FROM [Customer Info Table] INNER JOIN ([Booking Details Extended] INNER JOIN Bookings ON [Booking Details Extended].BookNumber = Bookings.BookNumber) ON ([Booking Details Extended].CustomerID = [Customer Info Table].CustomerID) AND ([Customer Info Table].CustomerID = Bookings.CustomerID)
WHERE (((Bookings.DateRecorded) Between #1/1/2014# And #12/31/2014#))
GROUP BY Format([Bookings.DateRecor
ASKER
Thanks! Sorry MX... but good to see you are local! You do a great job on this!
It appeared you had it backwards.
ASKER