When you run the query without the WHERE clause, do you see CategoryEnabled as one of the output columns?
Is it possible for you to post a sampel of output you get without the WHERE clause?
Main Topics
Browse All TopicsI have inherited a complex SQL query for Access 2000 which I have attached. It is not too important what the query does but I have had to modify it by adding the following statement in line 6 of the first SELECT clause:
(Select TOP 1 ItemCategories.Enable FROM ItemCategories WHERE Items.CategoryRefID = ItemCategories.RefId) AS CategoryEnabled
In the final WHERE clause I then use the result of this query by adding the following statement in line 34:
AND CategoryEnabled = True
Unfortunately when I run the query I get the following error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
If I leave the additional WHERE clause statement out the query runs without error but I need it to check the CategoryEnabled flag.
Any help would be appreciated.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Line 6 becomes:
(Select TOP 1 ItemCategories.Enable FROM ItemCategories WHERE Items.CategoryRefID = ItemCategories.RefId AND ItemCatgegories.Enable = True) AS CategoryEnabled
Be aware you cannot use an alias which you used in the SELECT portion of a query after THE FROM clause - you have to repeat the whole subquery. CategoryEnabled is an alias. Is is not just as easy to restrict the selection in the subquery??
Thanks for the suggestion GRayL but the solution you have given is not going to work as I need to read the CategoryEnabled alias so that I can restrict the rows returned from the query where CategoryEnabled=False.
I have taken a step back and now realise that I may have over complicated this. I have attached a modifed code which I believe is closer to what I require. The chages are as follows:
I now get the following error:
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'itemtexts.RefId=items.Ref
I believe there is a syntax issue with the join that I added. I am more familiar with SQL server so I may have got the syntax a little wrong for Access SQL.
Hi iparul,
Thanks for the new query but when I tried it I got the following error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'items.refID=t2.ItemRefID left join itemTexts on itemtexts.RefId=items.RefI
Remember that the query is for Access 2000. I think it may need extra brackets but I am not sure where.
Hi iparul,
If it helps, I posted another post here:
http://www.experts-exchang
In it I show the original query which does work and what I actually want to add. You may want to refer to this post as it gives a better starting point.
Okay
Here's what I would do:
Starting from the query that worked, and looking at the final query we have which doesn't give any errors, try adding one clause (where condition, join, additional col in select etc) one at a time and see if it gives the expected results. Here's the order I would do it
a) Add ItemCategories.Enable in the select statement
b) Add inner join statement
c) Add condition for ItemCategories.Enable = True
See if this helps and let me know.
Business Accounts
Answer for Membership
by: mbizupPosted on 2009-05-21 at 11:48:47ID: 24444620
The "too few paramaters" error means that a field name is unrecognized.
If this runs fine without the WHERE clause as you stated, scrutinize the WHERE clause for typos or incorrect field names.