Svar: RE: [AccessD] Weird query question

Gustav Brock Gustav at cactus.dk
Mon Jan 3 09:24:39 CST 2005


Hi Bobby

You have in the SQL one or more references to a form like:

.. =[Forms].[frmSomeForm].[txtSomeTextbox]

These are not understood when opening the query from code.
One method is to open it like this:

  Dim prm As Parameter
  ...
  Set qdf=dbs.QueryDefs("qdyYourQuery")
  For Each prm in qdf.Parameters
    prm.Value = Eval(prm.Name)
  Next
  Set rst = qdf.OpenRecordset()
  ...

/gustav

-----Original Message-----
From: Bobby Heid [mailto:bheid at appdevgrp.com] 
Sent: Monday, January 03, 2005 8:41 AM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Weird query question


Hey all,

I was modifying a query that a co-worker wrote so that it links with a
different sub query than the one it started with.  The query is a SQL
string
executed with a openrecordset command.

The problem is that if I am getting the classic "Too few
parameters..."
error message.  If I take the text and put it into a query and save it,
I
can run the query fine.  When I try to run that query with the
openrecordset
function using a querydef, I still get the error message.




More information about the AccessD mailing list