OK, slight correction of my sql...create a union query like:
SELECT Format([StartDate],"yyyy mm") as YrMth, "Ins" as Move
FROM Leases
UNION ALL
SELECT Format([EndDate],"yyyy mm"), "Outs"
FROM Leases
WHERE EndDate is not Null;
Save the above query and then create a new select query based on your
union query. Once the union query is displayed in the top panel of
your new query, change the query type to Crosstab. Add YrMth and two
copies of Move to the query grid. In the Crosstab property for YrMth,
select Row Heading. In the Crosstab for the first Move, select Column
Heading. In the Crosstab for the second Move, set the Total to Count
and the Crosstab to Value.
--
Duane Hookom
MS Access MVP
Joe Cilinceon said:
Thanks for responding Duane but I'm not following this. StartDate is
when they move in and EndDate is when the move out happens. There
will always be a startdate but not always and enddate. The crosstab
completely lost me since I've never used one before. I will want to
use this in a statistical report at the end of the year.
Duane Hookom wrote:
I would first create a union query:
SELECT Format([StartDate],"yyyy mm") as YrMth, "Ins" as Move
FROM Leases
UNION ALL
SELECT Format([StartDate],"yyyy mm"), "Outs"
FROM Leases;
You can then create a crosstab with YrMth as the Row Heading, Move
as the Column Heading, and Count(Move) as the Value.
--
Duane Hookom
MS Access MVP
What I'm trying to do is count the number of move-ins and move
outs grouped by months from Jan 2005 to Current Date. I want this
to help me get the average number of both move-ins and move-outs
by month. The table this query is on is as follows:
LEASES
StartDate
EndDate (will only have a date if vacated else Null)
I'm looking for something as follows:
Move Ins Move Outs
Jan. 9 5
Feb. 15 10
Mar 10 12
Hope this is clear.