The message you're getting is the ADO version of the old "Too Few Parameters: Expected 1" error message that you would get with DAO when trying to open a parameter query in VBA. When you open a query like this from within the normal Access UI, Access provides an expression service that will interpret the parameters before they are passed to Jet. When you open a query like this in VBA you are bypassing the Access UI so you don't get the help from the expression service. Jet (or whatever db engine you're connecting to - if you're using ADO it might be something else) knows nothing about Forms!frmHiddenDetails!txtUserCompany
, so you have to pass the value to the parameter yourself in your code. If you are going to use ADO, look here
for more help.