MS Access Error: Too few parameters. Expected x

If you are getting this error it means you are probably working. Here is the deal: this error happens when you try to access an Access Database through ODBC or OLEDB. Chances are you are trying to use Access’s standard of using double quotes (“), replace them with single quotes(‘) and you should be off and running.

If that still didn’t fix your problem the error is probably quite literal in that you forgot to add a parameter to your query or that you are missing some search criteria.

Let me know if this doesn’t work for you and I can help you get up and running.

8 thoughts on “MS Access Error: Too few parameters. Expected x

  1. I have a application. It asks for login. The moment I give my credentials, I get this “too few parameters. Expected 1″. I use ODBC foe SQL server. where should I change from ” to ‘???

    • I would check the where clause on anything that is after logging in, including the query that validates your credentials. Perhaps even through the queries in a message box so you can see the entire query, including any variables that might be concatenated in the query string.

  2. While working with microsoft access When i execute the following code…DRIVER DOESNOT SUPPORT THIS FUNCTION error is thrown…I could not fix it …Please help me.

    String str5 = “INSERT INTO Result” +”(Product,Price)VALUES” +” (?,?)”;
    PreparedStatement ps = con.prepareStatement(str5);
    ps.setString(1,s1 );

    • Is this code in c#? If you are in access, then you need to use the old VBA syntax. If you are calling access from a c# program, let me know and then i would need to know more details such as the type of connection you are using.

  3. Hi, I had the same problem..but its just that the variable names in access file and the variable names in query written in the excel are different. Correcting them has worked for me.

Have an opinion? Leave an opinion!

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s