Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

intermediate queries problem..

Status
Not open for further replies.

brianpercival

Programmer
Jun 13, 2005
63
US
I have an access application, one of the reports runs a query which itself triggers a series of queries with one as input to another etc. Now,

say there is Qry1 as
select f1 as Expr1, f2 as Expr2,f3 as Expr3 from t1

and Qry2 as

select [Qry1].[f1],[Qry1].[f2],[Qry1].[f3]from [Qry1]

Should this work? or should Qry2 be

select [Qry1].[Expr1],[Qry1].[Expr2],[Qry1].[Expr3]from [Qry1]

I am using access 2000.

Also I am guessing Expr1,expr2 etc. convention is auto generated when the query is created in the design view.

The application I am looking is supposedly working fine, but there seems to be this major flaw or the problem might be totally different, like perhaps a version problem.

Can anyone plz throw some light on this?


regards,
Brian
 
Qry2 should use Qry1.Expr1

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV,

I noticed this.. a couple of queries, as above, when I try to open them I get a msg saying so and so relationship cannot be shown. And then when I click OK, from then on, the qry2 above which uses qry1.f1,qry1.f2 form, stops working. meaning, qry2 no longer recognizes f1,f2,f3. But when I use qry1.expr1, etc in qry2, it works.

Any clue why it is happening? How does just opening a query for viewing change how it behaves??

regards,
Brian
 
Any clue why it is happening?
The aliases used in qry1 become the field names of qry1 when used as a table (in fact a View).

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV,

I understand that. But why should it work fine until the query is opened??

regards,
Brian
 
What is working fine until the query is opened??
 
PHV,

qry2 of this type

select [Qry1].[f1],[Qry1].[f2],[Qry1].[f3]from [Qry1]

works fine until the query is opened..(actually the query is not that simple but that is basically the jist) Once I try to open the query msg says" so and so join can not be represented". from then on when I try to run the application, it prompts me to enter a value for qry1.f1,qry1.f2 etc when it tries to run qry2.

I am kind of new to access, I noticed that when I write a query in sql view and save it and open later on it modifies the query a bit with padded braces etc. Now I am not sure whether the queries that I write are even saved exactly as I have written. Is this normal?


regards,
Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top