Query input must contain at least one table or query

  • Thread starter Thread starter robboll
  • Start date Start date
R

robboll

I have two queries -- the first is a query that has no tables, but
references two control values on a form:

Query1 TDATE:
SELECT Trim([FORMS]![CONSOLIDATED PLAN REPORT LIBRARY]![CFYEAR]) AS
[CURR-FISC-YR], "NOT USED" AS [CURR-FISC-QTR],
Trim([FORMS]![CONSOLIDATED PLAN REPORT LIBRARY]![CFmonth]) AS
[CURR-FISC-MTH], [CURR-FISC-YR]-1 AS [PREV-FISC-YR];

Query2 TAGCY
SELECT TDATE.[CURR-FISC-YR], TAGCY.AGENCY, TAGCY.[AGENCY-NAME]
FROM TDATE LEFT JOIN TAGCY ON TDATE.[CURR-FISC-YR] = TAGCY.[FISC-YEAR];


When I run TAGCY it immediately gives me the error: "Query input must
contain at least one table or query"

Is there any way to get around this error? Thanks for any tips.

RBollinger
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

PARAMETERS [FORMS]![CONSOLIDATED PLAN REPORT LIBRARY]![CFYEAR] Integer;

SELECT [FORMS]![CONSOLIDATED PLAN REPORT LIBRARY]![CFYEAR] As [CURR-FISC
YR], AGENCY, [AGENCY-NAME]

FROM TAGCY

WHERE [FISC-YEAR] = [FORMS]![CONSOLIDATED PLAN REPORT LIBRARY]![CFYEAR]

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQ9lSAYechKqOuFEgEQI+XgCeMNV84TX7UfaC29yKwntNHkn+dkAAn3Oq
dOBEji3jypLt6tqgVh8o03Rb
=RmI5
-----END PGP SIGNATURE-----
 
I have two queries -- the first is a query that has no tables, but
references two control values on a form:

Query1 TDATE:
SELECT Trim([FORMS]![CONSOLIDATED PLAN REPORT LIBRARY]![CFYEAR]) AS
[CURR-FISC-YR], "NOT USED" AS [CURR-FISC-QTR],
Trim([FORMS]![CONSOLIDATED PLAN REPORT LIBRARY]![CFmonth]) AS
[CURR-FISC-MTH], [CURR-FISC-YR]-1 AS [PREV-FISC-YR];

Query2 TAGCY
SELECT TDATE.[CURR-FISC-YR], TAGCY.AGENCY, TAGCY.[AGENCY-NAME]
FROM TDATE LEFT JOIN TAGCY ON TDATE.[CURR-FISC-YR] = TAGCY.[FISC-YEAR];


When I run TAGCY it immediately gives me the error: "Query input must
contain at least one table or query"

Is there any way to get around this error? Thanks for any tips.

Sure; just don't create the TDATE query at all.

SELECT [FORMS]![CONSOLIDATED PLAN REPORT LIBRARY]![CFYEAR] AS
[CURR-FISC-YR], TAGCY.AGENCY, TAGCY.[AGENCY-NAME]
FROM TAGCY WHERE [CURR-FISC-YR] = [FORMS]![CONSOLIDATED PLAN REPORT
LIBRARY]![CFYEAR];

You can create a "dummy" table with one field and one record (I call
mine DUAL since I once worked with Oracle, which has this builtin) and
do your select from DUAL, but I see no need to do so in this case.

John W. Vinson[MVP]
 
Thanks -- works like a champ
John said:
I have two queries -- the first is a query that has no tables, but
references two control values on a form:

Query1 TDATE:
SELECT Trim([FORMS]![CONSOLIDATED PLAN REPORT LIBRARY]![CFYEAR]) AS
[CURR-FISC-YR], "NOT USED" AS [CURR-FISC-QTR],
Trim([FORMS]![CONSOLIDATED PLAN REPORT LIBRARY]![CFmonth]) AS
[CURR-FISC-MTH], [CURR-FISC-YR]-1 AS [PREV-FISC-YR];

Query2 TAGCY
SELECT TDATE.[CURR-FISC-YR], TAGCY.AGENCY, TAGCY.[AGENCY-NAME]
FROM TDATE LEFT JOIN TAGCY ON TDATE.[CURR-FISC-YR] = TAGCY.[FISC-YEAR];


When I run TAGCY it immediately gives me the error: "Query input must
contain at least one table or query"

Is there any way to get around this error? Thanks for any tips.

Sure; just don't create the TDATE query at all.

SELECT [FORMS]![CONSOLIDATED PLAN REPORT LIBRARY]![CFYEAR] AS
[CURR-FISC-YR], TAGCY.AGENCY, TAGCY.[AGENCY-NAME]
FROM TAGCY WHERE [CURR-FISC-YR] = [FORMS]![CONSOLIDATED PLAN REPORT
LIBRARY]![CFYEAR];

You can create a "dummy" table with one field and one record (I call
mine DUAL since I once worked with Oracle, which has this builtin) and
do your select from DUAL, but I see no need to do so in this case.

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top