Using a query for criteria

G

Guest

I have a query(Query2) that uses another query(Query1) as the criteria.
Query2 selects data from a linked table using Query1. When selected to start,
I get a box asking to enter parameter values. But I am wanting Query1 to
enter the parameters/criteria. If I manually type the values into the
criteria field in Query2, the query runs fine.

Any help will be appreciated.
 
G

Guest

Query Name: Q_Get_Job_Numbers1
SELECT T_Temp_numbers.Number1, T_Temp_numbers.Number2
FROM T_Temp_numbers;

Query Name: Query 2
SELECT V_STSHEETDETL.JOB
FROM V_STSHEETDETL
WHERE (((V_STSHEETDETL.JOB)=[Q_Get_Job_Numbers1]![Number1] Or
(V_STSHEETDETL.JOB)=[Q_Get_Job_Numbers1]![Number2]));


Thanks
 
G

Guest

Several thing wrong. Try this.

SELECT V_STSHEETDETL.JOB
FROM V_STSHEETDETL, Q_Get_Job_Numbers1
WHERE (((V_STSHEETDETL.JOB)=[Q_Get_Job_Numbers1]![Number1] Or
(V_STSHEETDETL.JOB)=[Q_Get_Job_Numbers1]![Number2]))
GROUP BY V_STSHEETDETL.JOB;


Jim said:
Query Name: Q_Get_Job_Numbers1
SELECT T_Temp_numbers.Number1, T_Temp_numbers.Number2
FROM T_Temp_numbers;

Query Name: Query 2
SELECT V_STSHEETDETL.JOB
FROM V_STSHEETDETL
WHERE (((V_STSHEETDETL.JOB)=[Q_Get_Job_Numbers1]![Number1] Or
(V_STSHEETDETL.JOB)=[Q_Get_Job_Numbers1]![Number2]));


Thanks

KARL DEWEY said:
Post your SQL for both queries.
 
G

Guest

Karl, I appreciate the help. This worked.


KARL DEWEY said:
Several thing wrong. Try this.

SELECT V_STSHEETDETL.JOB
FROM V_STSHEETDETL, Q_Get_Job_Numbers1
WHERE (((V_STSHEETDETL.JOB)=[Q_Get_Job_Numbers1]![Number1] Or
(V_STSHEETDETL.JOB)=[Q_Get_Job_Numbers1]![Number2]))
GROUP BY V_STSHEETDETL.JOB;


Jim said:
Query Name: Q_Get_Job_Numbers1
SELECT T_Temp_numbers.Number1, T_Temp_numbers.Number2
FROM T_Temp_numbers;

Query Name: Query 2
SELECT V_STSHEETDETL.JOB
FROM V_STSHEETDETL
WHERE (((V_STSHEETDETL.JOB)=[Q_Get_Job_Numbers1]![Number1] Or
(V_STSHEETDETL.JOB)=[Q_Get_Job_Numbers1]![Number2]));


Thanks

KARL DEWEY said:
Post your SQL for both queries.

:

I have a query(Query2) that uses another query(Query1) as the criteria.
Query2 selects data from a linked table using Query1. When selected to start,
I get a box asking to enter parameter values. But I am wanting Query1 to
enter the parameters/criteria. If I manually type the values into the
criteria field in Query2, the query runs fine.

Any help will be appreciated.
 

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

Top