Solved

Creating Access Query with Criteria data from first row of another query

Posted on 2013-01-18
4
272 Views
Last Modified: 2013-01-18
I wish to create a query which findsall dates greater than the one defined in the first row of another unique query

I have done this with the criteria date showing in a live form but don't know how to bypass the form to go to the first date shown inquery directly

IE something like

SELECT [Q-ProjectTime].HoursDate,[Q-ProjectTime].Hours
FROM [Q-ProjectTime]
WHERE ((([Q-ProjectTime].HoursDate)>"[Q-ProcessPeriods].[StartDate](first row only)"));

Any suggestions?
0
Comment
Question by:ARampton
  • 2
4 Comments
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 250 total points
ID: 38793907
try this one


SELECT [Q-ProjectTime].HoursDate,[Q-ProjectTime].Hours
FROM [Q-ProjectTime]
WHERE [Q-ProjectTime].HoursDate > (select Top 1 [StartDate] from [Q-ProcessPeriods]);

might need more tweaking depending on the result of  [Q-ProcessPeriods]
0
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 250 total points
ID: 38793918
How do you define the "first row" of the other query?

Assuming that your other query is already sorted, you could do something like:

Something like:

SELECT [Q-ProjectTime].HoursDate,[Q-ProjectTime].Hours
FROM [Q-ProjectTime]
WHERE [Q-ProjectTime].HoursDate> (SELECT Top 1 [StartDate] FROM yourQuery)
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 38794285
:-0
0
 
LVL 30

Expert Comment

by:hnasr
ID: 38794304
Try this: pk is the primary key field of the table.

SELECT [Q-ProjectTime].HoursDate,[Q-ProjectTime].Hours
FROM [Q-ProjectTime]
WHERE ([Q-ProjectTime].HoursDate>(Select Max([Q-ProcessPeriods].[StartDate]) from [Q-ProcessPeriods] WHERE pk =(select min(pk) from [Q-ProcessPeriods]))
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This article will show you how to use shortcut menus in the Access run-time environment.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now