473,395 Members | 1,653 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Criteria based on a select statement

Hello,
Is it possible, in Access, to base the criteria of a query on another
query. Here's an example of what I mean:

SELECT ORDER_NO, DESC, TYPE, NAME
FROM [Cutting List]
WHERE ((([Cutting List].[ORDER_ NO])= SELECT JobID from jobs where code
= 20846));

In otherwords, the order number in the Cutting list table is the jobid
from the jobs table where the code = 20846.

This is possible in SQL Server isn't it? Or did I dream it?

Thanks for any help

Colin

Dec 20 '06 #1
2 2757
"Bobby" <bo****@blueyonder.co.ukwrote in message
news:11**********************@t46g2000cwa.googlegr oups.com...
Hello,
Is it possible, in Access, to base the criteria of a query on another
query. Here's an example of what I mean:

SELECT ORDER_NO, DESC, TYPE, NAME
FROM [Cutting List]
WHERE ((([Cutting List].[ORDER_ NO])= SELECT JobID from jobs where code
= 20846));

In otherwords, the order number in the Cutting list table is the jobid
from the jobs table where the code = 20846.

This is possible in SQL Server isn't it? Or did I dream it?
Try...

SELECT ORDER_NO, DESC, TYPE, NAME
FROM [Cutting List]
WHERE [Cutting List].[ORDER_ NO] = (SELECT JobID from jobs where code = 20846)

or

SELECT ORDER_NO, DESC, TYPE, NAME
FROM [Cutting List]
WHERE [Cutting List].[ORDER_ NO] In(SELECT JobID from jobs where code = 20846)
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Dec 20 '06 #2

Rick Brandt wrote:
Try...

SELECT ORDER_NO, DESC, TYPE, NAME
FROM [Cutting List]
WHERE [Cutting List].[ORDER_ NO] = (SELECT JobID from jobs where code = 20846)

or

SELECT ORDER_NO, DESC, TYPE, NAME
FROM [Cutting List]
WHERE [Cutting List].[ORDER_ NO] In(SELECT JobID from jobs where code = 20846)
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Thanks again Rick,

Colin

Dec 20 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Micromanaged | last post by:
Is it possible (and if so, how?) to have an asp form page that based upon a user's selection on a field, would generate a input field b that the user selects? For example: User selects "name"...
19
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main...
3
by: BerkshireGuy | last post by:
Hello, In VBA, I am grabbing the SQL statement of a query and want to modify the where clause based on what the users chooses. Here the code dim dbs as database dim qdf as querydef Dim...
2
by: dskillingstad | last post by:
I'm trying to set up a parameter query based on an unbound form. This search form has about 5 text boxes where the user can type in values within each box and search a specific table based on the...
7
by: keliie | last post by:
Hello Just a quick question that I've spent a few hours trying to solve with no luck (although one would think this should be fairly easy). I have a form with a subform. The subform is based...
3
by: rreitsma | last post by:
I want to create a form that will allow the user to select from a list of available reports and based on a filter limit the records displayed in the report. I have figured out how to access the...
10
by: Daniel | last post by:
In Microsoft Access I can write a query that includes the criteria: Between Date()-7 And Date() to retrieve the records from a table that fall within the last week. I'm trying to write a...
18
by: WU10 | last post by:
Built a form based on a select query with a combo box (3 choices) in the form header which will supply a value to the query. In the query's criteria I added the following expression - !! and...
1
by: Froefel | last post by:
I'm trying to populate a gridview control based on a user's search criteria, but what seemed like a trivial task turns out to be a nighmare for this newbie... maybe someone can help. Here's the...
2
by: Aussie Rules | last post by:
Hi, I have a access 2007 database with a cross tab query. Based on the selection critieria the cross tab may contain a different number columns in the result. For example if the query is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.