dbTalk Databases Forums  

A2K7 query dependency on a parameter query when used within a recordset

comp.databases.ms-access comp.databases.ms-access


Discuss A2K7 query dependency on a parameter query when used within a recordset in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
James A. Fortune
 
Posts: n/a

Default A2K7 query dependency on a parameter query when used within a recordset - 05-23-2011 , 08:35 AM






A2K7 doesn't seem to be as forgiving as earlier versions when running
queries based on parameter queries in the context of a recordset. The
parameter query runs fine by itself, even within a recordset, but
Access gets confused when it is used by a second query, one also
within a recordset. I have several crosstab queries that are based on
a parameter query that obtains a date within the desired week from a
form. Instead of using ADODB to supply parameters explicitly, I ended
up changing the SQL of the querydef for the parameter query to reflect
the actual date needed and eliminated using the parameter.

James A. Fortune
CDMAPoster (AT) FortuneJames (DOT) com

Reply With Quote
  #2  
Old   
John Spencer
 
Posts: n/a

Default Re: A2K7 query dependency on a parameter query when used within arecordset - 05-23-2011 , 03:02 PM






It may be that you already know this, but just in case.

With a crosstab query you MUST declare your parameters and if any
other queries are used in the crosstab their parameters must also be declared.

Open the query in design mode
Select Query: Parameters from the Menu
Fill in the EXACT name of the parameter in column 1
Select the data type of the parameter in column 2

If you are building the SQL String.
Parameters [Name of Parameter] Text(255), [Some Date parameter] DateTime;
SELECT xxx
FROM ...

Parameter line requires the name of the parameter and the data type.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

On 5/23/2011 9:35 AM, James A. Fortune wrote:
Quote:
A2K7 doesn't seem to be as forgiving as earlier versions when running
queries based on parameter queries in the context of a recordset. The
parameter query runs fine by itself, even within a recordset, but
Access gets confused when it is used by a second query, one also
within a recordset. I have several crosstab queries that are based on
a parameter query that obtains a date within the desired week from a
form. Instead of using ADODB to supply parameters explicitly, I ended
up changing the SQL of the querydef for the parameter query to reflect
the actual date needed and eliminated using the parameter.

James A. Fortune
CDMAPoster (AT) FortuneJames (DOT) com

Reply With Quote
Reply




Thread Tools
Display Modes

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

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.