Error in record set. (1 Viewer)

ANP

Registered User.
Local time
Today, 04:59
Joined
Dec 1, 2012
Messages
23
I have a form that shows continus details based on several queries depending which buttons you have clicked.

I have identified which query is in use and have got its sql code by using:-

stsql = qr.SQL

where qr is defind as "QueryDef" and stsql is defind as String

when I try and use this string as an argument to open up a record set it gives the following error.

"No value given for one or more required parameters"

I have working on it all day and can not work it out, can anyone be of assistance.

I have attached screen dumps of the code and the messages to assist.

Thank you in advance.

ANP
 

Attachments

  • FM.gif
    FM.gif
    15.1 KB · Views: 104
  • FM1.gif
    FM1.gif
    32.7 KB · Views: 92
  • FM2.gif
    FM2.gif
    24.4 KB · Views: 87

Beetle

Duly Registered Boozer
Local time
Today, 05:59
Joined
Apr 30, 2011
Messages
1,808
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.
 

ANP

Registered User.
Local time
Today, 04:59
Joined
Dec 1, 2012
Messages
23
Beetle,

Thanks for that - quite logical when you think about it!

ANP.
 

Users who are viewing this thread

Top Bottom