[ODBC Excel Driver] Too few parameters.

lukegtempleton

New Member
Joined
Jul 18, 2017
Messages
2
Hello,

I'm trying to create a query using the Microsoft Query Wizard that will query a table in another Excel Workbook. The command text that is generated by the Query Wizard is below. Works fine until I add a Where parameter (see below).

Command Text ("Tab" is the name of the worksheet containing the table I'm querying, in the source workbook I'm using):

SELECT `Tab$`.AssignDeptDesc, `Tab$`.BillingAreaInt, `Tab$`.Calc_Refer_Prov, `Tab$`.CC_Desc, `Tab$`.CC_Num, `Tab$`.ChgCorrFlag, `Tab$`.CountySum, `Tab$`.Dept_UniqPat, `Tab$`.DeptDesc, `Tab$`.FSCDesc, `Tab$`.Inv, `Tab$`.LOB, `Tab$`.PatientCityState, `Tab$`.PatientCountyDesc, `Tab$`.PatientID, `Tab$`.PatientZipCode, `Tab$`.PayerGroup, `Tab$`.ProviderDesc, `Tab$`.ProviderNum, `Tab$`.ProvType, `Tab$`.ReferProviderCityState, `Tab$`.ReferProviderDesc, `Tab$`.ReferProviderNPI, `Tab$`.ReferProviderNum, `Tab$`.ReferProviderZipCode, `Tab$`.RiskType, `Tab$`.RPCityState, `Tab$`.SLDept, `Tab$`.SvcDTInv, `Tab$`.SvcPd, `Tab$`.TotChgsInv
FROM `Tab$` `Tab$`

Where parameter:

WHERE `Tab$`.DeptDesc=?

The Enter Parameter Value window pops up, where I am choosing a particular cell on my excel worksheet, where I plan to put a data validation list of all DeptDesc values. Cell currently contains a valid DeptDesc value. I am choosing "Use this value/reference for future refreshes".

The error is receive is: [Microsoft][ODBC Excel Driver] Too few perameters. Expected 31.

31 is the number of fields in my query.

I have tried several variations of syntax in the where clause that I've seen online:

WHERE DeptDesc=?
WHERE `Tab$`.DeptDesc=?
WHERE (`Tab$`.DeptDesc=?)

All of them allow me to select the parameter value and then throw the above error.

This worked the first couple of times I tried it, without throwing any errors (using syntax: WHERE DeptDesc=?). I was able to change the value in my selected cell and refresh the query no problem.

One other thing I noticed: the query wizard was never able to see the actual table in my source workbook, and is always looking at the worksheet name instead. Is this a problem?

Any help would be greatly appreciated. Thanks!
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Re: [ODBC Excel Driver] Too few parameters. (yet another :)

hi, Luke

with 31 not found, it means the whole table is a problem. the query isn't connecting to the expected table.

Is one of these the problem : the source worksheet name has changed (from Tab), or the file/workbook name has changed (full file name including subdirectory)

if you re-create the query from scratch does it work?
If so, does that suit your needs. if not, what would?

regards, Fazza
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top