Link to home
Start Free TrialLog in
Avatar of Sandra Smith
Sandra SmithFlag for United States of America

asked on

Too few parameters. Expected 6 error in Excel using query in ACCESS

I have a large union query in an ACCESS 2003 database that combines 14 separate SELECT statements.  It takes a while to run, which is fine and it works in the database.  However, when opening Excel and trying to use this MASTER query I get "Too few parameters.  Expected 6" error.  The user, of course, wants to filter this large query down, but is the problem too many unions?
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Does the query refer to user defined functions ( which XL would not know about)?
<<I get "Too few parameters.  Expected 6" error.  The user, of course, wants to filter this large query down, but is the problem too many unions?>>

  This is an indication that you have specified a parameter reference some where in the SQL put have not provided a value for that parameter.

  Normally in Access when it runs a query, it does the work of evaluating the parameter for you and only prompts you if it can't evaluate it (ie. it is a form/control reference and the form is not open or the control does not exist on the open form).

  However if you run the same SQL in code, it's up to you to do the job.

  I'd look at your WHERE clauses.

JimD

  BTW, you have 6 parameters that you have not provided a value for.

JimD
Avatar of Sandra Smith

ASKER

Ok, there are several cells that are null and in the where clause are requests for parameters.  Let me see if this makes a difference.  Be right back.
Does not refer to any user defined functions and I filled in all the nulls and still get the same error.  The union query pulls a lot of data based on quite a few parameters for each SELECT statement.  When I am in Excel and just pull in the entire query results, everything comes in, but when I try to filter, there is nothing in the filter criteria section in the wizard and the i get the error.  Perhaps the quantity of criteria in the SELECT statements in the union query plus the criteria selection in the Excel are just too much?
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
OK, will break down the parts and check field names as well.  Be back in a bit.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No, just gives me the error message.  Ok, I worked on this thing all day yesterday and am giving up.  I just have the results turned into a table from which the user draws the information.  Thanks for all the suggestions, but I am running out of time.  I am going split the points as all of you tried to help.
<<Ok, I worked on this thing all day yesterday and am giving up. >>

  Sorry to hear that.  If you have a moment, could you please post one of the SQL Selects here?  

Thanks,
JimD