# Microsoft Access: Selecting from a query

**URL:** https://boards.straightdope.com/t/microsoft-access-selecting-from-a-query/694147
**Category:** In My Humble Opinion
**Created:** [July 27, 2014, 6:46am UTC](https://boards.straightdope.com/t/microsoft-access-selecting-from-a-query/694147 "2014-07-27T06:46:50Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Frylock](https://avatars.discourse-cdn.com/v4/letter/f/ce7236/32.png) [@Frylock](https://boards.straightdope.com/u/Frylock)
#### Post date: [July 27, 2014, 6:46am UTC](https://boards.straightdope.com/t/microsoft-access-selecting-from-a-query/694147/1 "2014-07-27T06:46:50Z")

</div>

Why isn’t this working?

I’m toying around with SQL in MS Access. I have a table, called “TransEx.” I have a query that goes:

SELECT DISTINCT F1, F2  
FROM TransEx  
WHERE F4 = “SPA 200”.

That one works. Then I have another query, that goes:

SELECT F1  
FROM Query1

And when I try to run that one, it says Access can’t find the table or query Query1. But there it is right there on my screen. By which I mean, to the right of the “TransEx” tab I see another tab that says “Query1,” which contains that first query I typed up above. “Query2”, meanwhile, is on the tab to the right of “Query1”, and it’s Query2 that claims its neighbor Query1 doesn’t exist…

What obvious thing am I missing here?

---

<div class="post-metadata">

### Author: ![zoid](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zoid/32/336_2.png) [@zoid](https://boards.straightdope.com/u/zoid)
#### Post date: [July 27, 2014, 7:01am UTC](https://boards.straightdope.com/t/microsoft-access-selecting-from-a-query/694147/2 "2014-07-27T07:01:26Z")

</div>

Did you save the first query as “Query1”

Access has no way of knowing what “Query1” is unless you save it.  
Or did you perhaps name your first query something else?

---

<div class="post-metadata">

### Author: ![Frylock](https://avatars.discourse-cdn.com/v4/letter/f/ce7236/32.png) [@Frylock](https://boards.straightdope.com/u/Frylock)
#### Post date: [July 27, 2014, 7:29am UTC](https://boards.straightdope.com/t/microsoft-access-selecting-from-a-query/694147/3 "2014-07-27T07:29:31Z")

</div>

That was it–I didn’t realize I had to save the query.

---

<div class="post-metadata">

### Author: ![zoid](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zoid/32/336_2.png) [@zoid](https://boards.straightdope.com/u/zoid)
#### Post date: [July 27, 2014, 9:36pm UTC](https://boards.straightdope.com/t/microsoft-access-selecting-from-a-query/694147/4 "2014-07-27T21:36:43Z")

</div>

Glad you got it fixed

---

<div class="post-metadata">

### Author: ![JerrySTL](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@JerrySTL](https://boards.straightdope.com/u/JerrySTL)
#### Post date: [July 29, 2014, 3:59pm UTC](https://boards.straightdope.com/t/microsoft-access-selecting-from-a-query/694147/5 "2014-07-29T15:59:43Z")

</div>

You don’t “have” to save it. You can create a subquery by putting a query within a query like so:

Select F1  
FROM (SELECT DISTINCT F1, F2  
FROM TransEx  
WHERE F4 = “SPA 200”);

Of course it would be a little silly to create such a query in the above case, there are plenty of reasons to use a sub-queries especially when using HAVING and IN clauses.
