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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|