[AccessD] Help with syntax please....OpenRecordset

Kath Pelletti KP at sdsonline.net
Tue Oct 12 22:50:15 CDT 2004


Done, done and done. Thanks all for your help. I had no idea that a form criterion parameter couldn't be used in that way and could have wasted even more time. 

Kath
  ----- Original Message ----- 
  From: Stuart McLachlan 
  To: Access Developers discussion and problemsolving 
  Sent: Wednesday, October 13, 2004 1:00 PM
  Subject: Re: [AccessD] Help with syntax please....OpenRecordset


  On 13 Oct 2004 at 11:46, Kath Pelletti wrote:

  > I am trying to use a saved query for my recordset source....but keep getting an error 'Too few parameters - expected 1' on the line 'Set rs = '
  > After many hours, I can't fix it so would appreciate the help.....
  > 

  The problem is in the query "QryWebLetter_ReadRecipientsEmai". You are 
  probably using a reference a control on a form as a criterion/paramter for 
  your query. You can't do that when you call the query as a recordset.

  My usual workaround is to create a Static function called StoredValue() to 
  store the parameter, change the criterion in the query to "=StoredValue()" 
  and set the value of the function before calling the query  with 
  "retval = StoredValue(Forms!myForm.myControl)" or just
  "StoredValue Forms!myForm.myControl"








  -- 
  Stuart


  -- 
  _______________________________________________
  AccessD mailing list
  AccessD at databaseadvisors.com
  http://databaseadvisors.com/mailman/listinfo/accessd
  Website: http://www.databaseadvisors.com


More information about the AccessD mailing list