MS Access SQL Error - Too Few parameters. Expected 1.

Hello,
I get an error Too Few parameters.  Expected 1 when I run the following query in MS Query to load data into Excel from an Access database.

I'm an Oracle SQL guy, not this flaky MS stuff.  Any ideas?  I had to do this rediculous subquery to get only the current times from the tblconsumption join.
Select tblCustomer.ShipToNumber,
tblCustomer.Description,
tblProduct.ProductNumber,
tblTankGroup.TankOrGroupID,
tblCustomer.Route,
tblTankGroup.SpecifiedCapacity,
tblConsumption.ProjectedInventory,
tblConsumption.DCF,
tblConsumption.RunoutDate,
tblConsumption.DeliveryDate
from tblCustomer,
tblProduct,
tblTankGroup,
tblConsumption
Where tblCustomer.CustomerID = tblTankGroup.CustomerID
AND tblProduct.ProductID = tblTankGroup.ProductID
AND tblConsumption.TankGroupID = tblTankGroup.TankGroupID
AND tblConsumption.ConsumptionID in
   (select tblConsumption.consumptionID from tblConsumption
     Where tblconsumption.runoutdate <= dateadd("ww", 4,date()))

Open in new window

LVL 1
DwayneZandbergenAsked:
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.

carsRSTCommented:
I believe you want to change this line:
Where tblconsumption.runoutdate <= dateadd("ww", 4,date()))


to this:
Where tblconsumption.runoutdate <= dateadd("ww", 4,now()))
0
DwayneZandbergenAuthor Commented:
Sorry - same deal...  "Too few parameters.  Expected 1" comes up.
0
carsRSTCommented:
I would check all your fields for misspellings - usually the cause of that particular error.

One you might look at is tblTankGroup.TankOrGroupID

It may be correct but I noticed a tblTankGroup.TankGroupID too (with no "Or" in the middle)
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.

DwayneZandbergenAuthor Commented:
When I changed the dateadd("ww",4,Date()) to dateadd('ww',4,Date()), the SQL quasi works, except the date section.
0
Rory ArchibaldCommented:
How are you doing this in Excel? Via MSQuery or in code?
0
carsRSTCommented:
Yeah, that's the issue.  I overlooked that.  Also date function should be ok.

If you're looking to add weeks then use 'ww'
If you want to add days then put in 'd'
0
NerdsOfTechTechnology ScientistCommented:
FIX. remove quote characters please:
Select tblCustomer.ShipToNumber,
tblCustomer.Description,
tblProduct.ProductNumber,
tblTankGroup.TankOrGroupID,
tblCustomer.Route,
tblTankGroup.SpecifiedCapacity,
tblConsumption.ProjectedInventory,
tblConsumption.DCF,
tblConsumption.RunoutDate,
tblConsumption.DeliveryDate
from tblCustomer,
tblProduct,
tblTankGroup,
tblConsumption
Where tblCustomer.CustomerID = tblTankGroup.CustomerID
AND tblProduct.ProductID = tblTankGroup.ProductID
AND tblConsumption.TankGroupID = tblTankGroup.TankGroupID
AND tblConsumption.ConsumptionID in
   (select tblConsumption.consumptionID from tblConsumption
     Where tblconsumption.runoutdate <= dateadd(ww, 4,date())
   )

Open in new window

0
NerdsOfTechTechnology ScientistCommented:
removed quote marks from original line 20 "ww" -> ww
Normalized capitalization for SQL
SELECT tblCustomer.ShipToNumber,
tblCustomer.Description,
tblProduct.ProductNumber,
tblTankGroup.TankOrGroupID,
tblCustomer.Route,
tblTankGroup.SpecifiedCapacity,
tblConsumption.ProjectedInventory,
tblConsumption.DCF,
tblConsumption.RunoutDate,
tblConsumption.DeliveryDate
from tblCustomer,
tblProduct,
tblTankGroup,
tblConsumption
WHERE tblCustomer.CustomerID = tblTankGroup.CustomerID
AND tblProduct.ProductID = tblTankGroup.ProductID
AND tblConsumption.TankGroupID = tblTankGroup.TankGroupID
AND tblConsumption.ConsumptionID in
(
 SELECT tblConsumption.consumptionID from tblConsumption
 WHERE tblconsumption.runoutdate <= dateadd(ww, 4, date())
)

Open in new window

0
NerdsOfTechTechnology ScientistCommented:
Normalized.
SELECT tblCustomer.ShipToNumber,
tblCustomer.Description,
tblProduct.ProductNumber,
tblTankGroup.TankOrGroupID,
tblCustomer.Route,
tblTankGroup.SpecifiedCapacity,
tblConsumption.ProjectedInventory,
tblConsumption.DCF,
tblConsumption.RunoutDate,
tblConsumption.DeliveryDate
FROM tblCustomer,
tblProduct,
tblTankGroup,
tblConsumption
WHERE tblCustomer.CustomerID = tblTankGroup.CustomerID
AND tblProduct.ProductID = tblTankGroup.ProductID
AND tblConsumption.TankGroupID = tblTankGroup.TankGroupID
AND tblConsumption.ConsumptionID IN
(
 SELECT tblConsumption.consumptionID 
 FROM tblConsumption
 WHERE tblconsumption.runoutdate <= DATEADD(ww, 4, date())
)

Open in new window

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
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
Query Syntax

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.