Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Query: Too few parameters 1

Status
Not open for further replies.

Gavona

Technical User
Aug 27, 2002
1,771
0
0
GB
I am using excel 2010 (and I have PowerQuery installed but not used in this workbook).
The source data is a table in another workbook.
The message I get is "Too few parameters. Expected 3." Why would it expect 3? How do I best resolve this, please?

The SQL is:
SELECT `Data$ExternalData_1`.`Cost Center`, [deleted rest of Select]
FROM `Data$ExternalData_1` `Data$ExternalData_1`
WHERE (`Data$ExternalData_1`.`UserID Combined` Like ?) AND (`Data$ExternalData_1`.`LA01#LA01_1` Like ?)

If from MS Query I try to return the data to Excel I get prompted for two parameters which is what I would expect and then I get the error message.

The connection Properties are set to get the parameters from specific cells in the workbook

Gavin
 
Hi,

This error message occurs when there are any fields that the MS Query Manager cannot resolve. So one of your Field Names or Table Name is incorrect, perhaps there’s a leading or trailing space missing.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
That makes total sense, I have been tweaking the source data, thanks Skip. My internet searching didn't turn up that simple fact :(

[bigsmile]

Gavin
 
Are you using an alias for a table with the same name?
[tt]
FROM `Data$ExternalData_1` `Data$ExternalData_1`[/tt]


---- Andy

There is a great need for a sarcasm font.
 
Your SQL ought to look like this for the Like operator...
Code:
Where YourField Like ‘%’ & [?] & ‘%’

BTW, my iPad TIC marks (‘’) won’t actually work.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Thanks for the additional pointers - I'll have a play with both of your suggestions. I have it working - resolved by Skip's first response (which sort of explains my tardiness in coming back to the post!).

I think I can see what you are both getting at. I used MS Query to create the SQL. I will try tweaking it (and the table name) just so I learn a bit more about SQL. (Mind you, I have just got Power Query and that looks a better tool to focus my learning on than SQL :) )

Gavin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top