Can this be done in a Report?

S

Sean

I have a table of data called table1 and it has 2 fields, OrderNum and Time.
I want to have a report that will count the number of orders between
certian time frames and I want it to appear in one result set. So if I
wanted to see the number of orders between 0:00 and 4:00, 4:01 and 12:00,
12:01 and 16:00 I would get 3 different results all in one report. If
someone could provide me an example that would be great.

Thanks
 
D

Duane Hookom

I would create a table of time frames:
tblTimeFrames
===================
StartTime Date/Time
EndTime Date/Time
TFTitle Text

Add your records.

You could then create a query with Table1 and tblTimeFrames. The SQL view
would be:

SELECT StartTime, EndTime, TFTitle, Count(OrderNum) as NumOrders
FROM table1, tblTimeFrames
WHERE [Time] Between StartTime And EndTime
GROUP BY StartTime, EndTIme, TFTitle;
 
S

Sean

I am having trouble getting it to run, I get an error with the following code:

SELECT TimeFrame.TFTitle, Count(OrderLineDetails.[Order Number]) AS
[CountOfOrder Number]
FROM OrderLineDetails, TimeFrame
WHERE (((OrderLineDetails.Time) Between "Starttime" And "EndTime"))
GROUP BY TimeFrame.StartTime, TimeFrame.EndTime, TimeFrame.TFTitle;


Duane Hookom said:
I would create a table of time frames:
tblTimeFrames
===================
StartTime Date/Time
EndTime Date/Time
TFTitle Text

Add your records.

You could then create a query with Table1 and tblTimeFrames. The SQL view
would be:

SELECT StartTime, EndTime, TFTitle, Count(OrderNum) as NumOrders
FROM table1, tblTimeFrames
WHERE [Time] Between StartTime And EndTime
GROUP BY StartTime, EndTIme, TFTitle;

--
Duane Hookom
Microsoft Access MVP


Sean said:
I have a table of data called table1 and it has 2 fields, OrderNum and Time.
I want to have a report that will count the number of orders between
certian time frames and I want it to appear in one result set. So if I
wanted to see the number of orders between 0:00 and 4:00, 4:01 and 12:00,
12:01 and 16:00 I would get 3 different results all in one report. If
someone could provide me an example that would be great.

Thanks
 
D

Duane Hookom

Remove the quotes from around your field names:
SELECT TFTitle, Count([Order Number]) AS [CountOfOrder Number]
FROM OrderLineDetails, TimeFrame
WHERE [Time] Between [Starttime] And [EndTime]
GROUP BY TFTitle;

--
Duane Hookom
Microsoft Access MVP


Sean said:
I am having trouble getting it to run, I get an error with the following code:

SELECT TimeFrame.TFTitle, Count(OrderLineDetails.[Order Number]) AS
[CountOfOrder Number]
FROM OrderLineDetails, TimeFrame
WHERE (((OrderLineDetails.Time) Between "Starttime" And "EndTime"))
GROUP BY TimeFrame.StartTime, TimeFrame.EndTime, TimeFrame.TFTitle;


Duane Hookom said:
I would create a table of time frames:
tblTimeFrames
===================
StartTime Date/Time
EndTime Date/Time
TFTitle Text

Add your records.

You could then create a query with Table1 and tblTimeFrames. The SQL view
would be:

SELECT StartTime, EndTime, TFTitle, Count(OrderNum) as NumOrders
FROM table1, tblTimeFrames
WHERE [Time] Between StartTime And EndTime
GROUP BY StartTime, EndTIme, TFTitle;

--
Duane Hookom
Microsoft Access MVP


Sean said:
I have a table of data called table1 and it has 2 fields, OrderNum and Time.
I want to have a report that will count the number of orders between
certian time frames and I want it to appear in one result set. So if I
wanted to see the number of orders between 0:00 and 4:00, 4:01 and 12:00,
12:01 and 16:00 I would get 3 different results all in one report. If
someone could provide me an example that would be great.

Thanks
 
S

Sean

Thank you

Duane Hookom said:
Remove the quotes from around your field names:
SELECT TFTitle, Count([Order Number]) AS [CountOfOrder Number]
FROM OrderLineDetails, TimeFrame
WHERE [Time] Between [Starttime] And [EndTime]
GROUP BY TFTitle;

--
Duane Hookom
Microsoft Access MVP


Sean said:
I am having trouble getting it to run, I get an error with the following code:

SELECT TimeFrame.TFTitle, Count(OrderLineDetails.[Order Number]) AS
[CountOfOrder Number]
FROM OrderLineDetails, TimeFrame
WHERE (((OrderLineDetails.Time) Between "Starttime" And "EndTime"))
GROUP BY TimeFrame.StartTime, TimeFrame.EndTime, TimeFrame.TFTitle;


Duane Hookom said:
I would create a table of time frames:
tblTimeFrames
===================
StartTime Date/Time
EndTime Date/Time
TFTitle Text

Add your records.

You could then create a query with Table1 and tblTimeFrames. The SQL view
would be:

SELECT StartTime, EndTime, TFTitle, Count(OrderNum) as NumOrders
FROM table1, tblTimeFrames
WHERE [Time] Between StartTime And EndTime
GROUP BY StartTime, EndTIme, TFTitle;

--
Duane Hookom
Microsoft Access MVP


:

I have a table of data called table1 and it has 2 fields, OrderNum and Time.
I want to have a report that will count the number of orders between
certian time frames and I want it to appear in one result set. So if I
wanted to see the number of orders between 0:00 and 4:00, 4:01 and 12:00,
12:01 and 16:00 I would get 3 different results all in one report. If
someone could provide me an example that would be great.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top