Excel VBA Query Doesn't Work After Upgrade from 2003 to 2007

NumberGuy

New Member
Joined
Mar 19, 2012
Messages
4
I have a Microsoft query that I created in Excel 2003, and saved the results as an Excel spreadsheet. The query pulls the data from another spreadsheet. I refresh the results each month by opening the spreadsheet, right-clicking within the results table, and choosing Refresh Data. I recently upgraded to Excel 2007. Now when I try to refresh the results, I get the following message: "[Microsoft] [ODBC Excel Driver] Too few parameters. Expected 4."

I have verified that the query still works on my former machine running Excel 2003.

I have tried creating a new query from scratch in Excel 2007, and get the same error message. I have tried saving the queried spreadsheet as an .xlsm file and then creating a new query from scratch, and get the same error message. I have tried reducing the number of fields in the query to the bare minimum needed to produce results, but the only difference is that the error message reports a lower Expected number. I have tried modifying the field names to eliminate blank spaces, and I get the same error message.

I'm out of ideas. Any help would be greatly appreciated!
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Well, I found the problem. It turns out that in several of the fields queried, the field names had leading spaces preceding the text. Excel 2003 didn't mind the spaces, but Excel 2007 wouldn't accept them.
 
Upvote 0

Forum statistics

Threads
1,216,816
Messages
6,132,868
Members
449,761
Latest member
AUSSW

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