0

In Access 2013 db, I've written two queries.

A Query having Parameter

SELECT [par], IIf(Len([par])>=4,Left(([par]),4),"") AS first_part, IIf(Len([par])>=6,Left(([par]),6),"") AS second_part, IIf(Len([par])>=8,Left(([par]),8),"") AS third_part;

A Query without Parameter

SELECT par_list.par, IIf(Len(par_list.par)>=4,Left((par_list.par),4),"") AS first_part, IIf(Len(par_list.par)>=6,Left((par_list.par),6),"") AS second_part, IIf(Len(par_list.par)>=8,Left((par_list.par),8),"") AS third_part
FROM par_list;

I want to rewrite the second query with the first query. How ?

I want to use the first query as function within other queries. How ?

Most Access parameter query call examples use VBA. CAN we call parameter query within another query, WITHOUT using VBA?

Raymond
  • 885
  • 10
  • 28
  • Perhaps you might find [this answer](http://stackoverflow.com/a/16571156/2144390) helpful. – Gord Thompson May 05 '15 at 07:42
  • I've read (and tried) the latest answer. He/She uses a intermediate table to pass parameters. My curiosity is CAN we call parameter query within another query, WITHOUT using VBA? It seems, we cannot, we MUST use VBA. – Raymond May 05 '15 at 12:34

1 Answers1

0

Do use VBA for this. That is also what it is intended for, and it will save you a lot of trouble when debugging.

Gustav
  • 53,498
  • 7
  • 29
  • 55
  • 1
    You should note that the OP can easily make his code reusable by using VBA, which can then be called by his queries and used as a function. – Mark C. May 05 '15 at 13:05
  • My concern is CAN or CANNOT. Do we CANNOT reuse parameter query within query? I've read access reference, it seems true. – Raymond May 07 '15 at 12:17
  • Your so called parameter query will return one row. If you save this, it can be used as source or joined into another query, if that is what you ask, but I see no practical use for it. What have you tried in the two days passed? – Gustav May 07 '15 at 12:29