Chat with a LIVE Microsoft Access Expert!
 
       
 

         

   

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

 
 
Chat with a LIVE Microsoft Access Expert!
Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 05-05-2003, 09:37 AM
dungstar dungstar is offline
Registered User
 
Join Date: Mar 2002
Location: Seattle, WA, King
Posts: 72
dungstar
Error opening query recordset that references control object

I have a several saved queries that are hierarchically dependent. In one of my forms I need to access one of the queries.

Set rs = db.OpenRecordset("qryCTI_Unbilled")

But I get an error:
Run-time error '3601': Too few parameters. Expected 2.

The strange thing about this is, if I open the query directly, it has all the information I need, and I get no errors.

What seems to be causing the problem is in the WHERE clause where I reference a textbox from the form.

...WHERE (((ars5_budgets1.DATE_FROM)<=[Forms]![frmCTI]![txtBillDateEnd]) ...

This is referenced in the a query at the base of the nested structure.

Is this doable? Based on the debug, I am thinking that in runtime mode, the query is not able to pick up these control object values to process the query, because in debug mode, when the error pops up, I get no records when I open the query.

I guess an alternative would be to write the entire SQL statement as a string and assign the object values to VBA variable. Doing this at runtime may effect performance because of the complexity, but at least that's a solution.

Any alternative solution is appreciated, thanks!

Last edited by dungstar; 05-05-2003 at 11:08 AM..
Reply With Quote
Sponsored Links
  #2  
Old 05-05-2003, 11:08 AM
Elana's Avatar
Elana Elana is offline
Senior Member
 
Join Date: Apr 2000
Location: Seattle, WA
Posts: 232
Elana
Hi - check out this MS Knowledge Base article #209203 - should solve your problem:

http://support.microsoft.com/default...b;en-us;209203

HTH
E
Reply With Quote
  #3  
Old 05-05-2003, 12:05 PM
dungstar dungstar is offline
Registered User
 
Join Date: Mar 2002
Location: Seattle, WA, King
Posts: 72
dungstar
Thanks a bunch Elana, fellow Seattlite!
Reply With Quote
Sponsored Links
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
(c) copyright 2009 Access World