Results 1 to 2 of 2

Thread: [ODBC Excel Driver] Too few parameters.
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Jul 2017
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)

    Default [ODBC Excel Driver] Too few parameters.


    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!

  2. #2
    MrExcel MVP
    Join Date
    May 2006
    Excel 2003, Australia
    Post Thanks / Like
    7 Post(s)
    3 Thread(s)

    Default 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
    To receive a better answer, put more work into asking the question.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts