[AccessD] Weird query question

Gustav Brock Gustav at cactus.dk
Mon Jan 3 10:11:15 CST 2005


Hi Bobby

Some times it helps to state them as parameters in the main query:

PARAMETERS [Forms]![TempVars].[txtProjectID] Long;
SELECT ... etc.

/gustav

>>> bheid at appdevgrp.com 03-01-2005 16:57:03 >>>
Thanks for the reply Gustav.

I use references like that all of the time.  As a matter of fact, the
Contractor ID and ProjectID were in the original query that works also
as a
querydef.

The parameters that are accessing the dates are in the subquery.  Could
that
be where the issue is?

Thanks,
Bobby

-----Original Message-----
From: accessd-bounces at databaseadvisors.com 
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav
Brock
Sent: Monday, January 03, 2005 10:25 AM
To: accessd at databaseadvisors.com 
Subject: Svar: RE: [AccessD] Weird query question


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