'No value given for one or more required parameters error on one machine but not another

I have VBA code working in Excel on my machine but it is giving the above error on someone else's machine. What would be causing it to work for me but not for someone else?

'---Connecting to the Data Source---
Set cn = CreateObject("ADODB.Connection")
With cn
    .Provider = "Microsoft.ACE.OLEDB.12.0"
    .ConnectionString = "Data Source=" & wb.Path & "\" & wb.Name & ";" & "Extended Properties=""Excel 12.0 Xml;HDR=YES"";"
    .Open
End With


'---Run the SQL SELECT Query---
sql = "SELECT " & _
          "sum([" & cash_projections.Name & "$].[Projected Ending Balance]), " & _
          "[" & cash_projections.Name & "$].[Account Name (Balance)], " & _
          "[" & cash_projections.Name & "$].[Projected Date] " & _
      "FROM " & _
          "[" & cash_projections.Name & "$] " & _
      "WHERE " & _
          "[" & cash_projections.Name & "$].[Projected Ending Balance] > 100 " & _
      "GROUP BY " & _
          "[" & cash_projections.Name & "$].[Account Name (Balance)], " & _
          "[" & cash_projections.Name & "$].[Projected Date] " & _
      "ORDER BY " & _
          "[" & cash_projections.Name & "$].[Account Name (Balance)], " & _
          "[" & cash_projections.Name & "$].[Projected Date] "
Set rs = cn.Execute(sql)

The error shows up on the last line of this code. Again, it works just fine for me, but gives the error on another machine.

Please note that I am using the exact same workbook as is being used on the other computer. Here are the column headings

enter image description here



Solution 1:[1]

The line that is causing the error is the one that is executing your query. Because the code does not fail when you open the connection, it means it is finding the workbook you are querying just fine. My guess is that the workbook it finds has a different structure on the two machines. Because it says a parameter is missing a value, it means that something that is defined on your machine is missing on the other, it could be a table name or a column name. Basically, when you use that name on your machine it finds it and moves on. On the other machine, it can't find it so it assumes it must be parameter.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gove