Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 02-18-2013, 10:53 AM   #1
ANP
Newly Registered User
 
Join Date: Dec 2012
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
ANP is on a distinguished road
Error in record set.

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
Attached Images
File Type: gif FM.gif (15.1 KB, 84 views)
File Type: gif FM1.gif (32.7 KB, 69 views)
File Type: gif FM2.gif (24.4 KB, 70 views)

ANP is offline   Reply With Quote
Old 02-18-2013, 01:15 PM   #2
Beetle
Duly Registered Boozer
 
Join Date: Apr 2011
Location: Camp Swampy (Denver, CO)
Posts: 1,806
Thanks: 13
Thanked 458 Times in 449 Posts
Beetle will become famous soon enough Beetle will become famous soon enough
Re: Error in record set.

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.
__________________
Sean Bailey

Dim Thirsty As String
Thirsty = "Insert Into Glass (Select Beer From Fridge)"
DoCmd.Execute Thirsty, dbPourAnotherOnError
Beetle is offline   Reply With Quote
Old 02-19-2013, 02:53 AM   #3
ANP
Newly Registered User
 
Join Date: Dec 2012
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
ANP is on a distinguished road
Re: Error in record set.

Beetle,

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

ANP.

ANP is offline   Reply With Quote
Reply

Tags
code , csv , vba

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error Number of Duplicate Record Error Ironis Modules & VBA 6 05-05-2015 11:16 AM
Duplicate record names error message when only editing existing record.. vb9063 Forms 3 06-24-2010 12:42 AM
help with form and error msg Add Or Change A Record Because A Related Record Is Requi miken5678 Forms 4 07-28-2008 07:28 AM
Navigating to different record causes error when new record changes are undone johnlondon Forms 10 07-21-2008 12:27 PM
"Run Time Error 3167 - Record is Deleted" - error ecomajor Queries 1 03-30-2005 03:15 AM




All times are GMT -8. The time now is 09:11 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World