A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Between Dates and All Dates for those Records



 
 
Thread Tools Display Modes
  #1  
Old July 1st, 2009, 04:49 PM posted to microsoft.public.access
Em D
external usenet poster
 
Posts: 1
Default Between Dates and All Dates for those Records

My database contains several dates for each person the dates are associated
with. I would like to have a query return all dates for each person ONLY if
they have a date between Date1 and Date2. (Date1 and Date2 would be
determined using parameters.)
  #2  
Old July 1st, 2009, 05:16 PM posted to microsoft.public.access
John Spencer MVP
external usenet poster
 
Posts: 533
Default Between Dates and All Dates for those Records

Use a subquery in the where clause to identify the persons that have records
in the specified time frame.

The SQL of the query would look something like the following:

Parameters [Enter Start Date] DateTime, [Enter End Date] DateTime;
SELECT PersonID, ActivityDates
FROM SomeTable
WHERE PersonID in
(SELECT PersonID
FROM SomeTable
WHERE SomeDateField between [Enter Start Date] and [Enter End Date])

If you don't know how to use the SQL window to construct a query, post back
with your existing query (View: SQL then copy and paste into the posting).

Then hopefully someone can modify the existing query. Or ask for step-by-step
instructions on how to build the query in Query Design view.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

Em D wrote:
My database contains several dates for each person the dates are associated
with. I would like to have a query return all dates for each person ONLY if
they have a date between Date1 and Date2. (Date1 and Date2 would be
determined using parameters.)

  #3  
Old July 1st, 2009, 05:42 PM posted to microsoft.public.access
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Between Dates and All Dates for those Records

"How" depends on "what" ... what data structure are you using?

Do you have "several date [fields]" in your table, or a table with multiple
rows, each one containing one date value for one person?

Regards

Jeff Boyce
Microsoft Office/Access MVP

"Em D" Em wrote in message
...
My database contains several dates for each person the dates are
associated
with. I would like to have a query return all dates for each person ONLY
if
they have a date between Date1 and Date2. (Date1 and Date2 would be
determined using parameters.)



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:50 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.