Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 4th, 2006, 11:30 AM
Registered User
 
Join Date: Sep 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Query Help - Display numbers from two Months

I am trying to make a very simple report.
I want to display billable hours for each Rep for both this month and last month on this report. I have two queries (not sure if I can do it on one Query or not) One query has the criteria month(date()) and the other one has Month(Date())-1.

I guess there are two questions:
1. Can I get both values from one Query?
2. How can I display both numbers on one report.

Thanks for the help.

Here is the SQL View of my Queries.

SELECT DISTINCTROW Rep.FirstName, Sum(WorkorderTime.WorkOrderTime) AS [Sum Of WorkOrderTime]
FROM Rep RIGHT JOIN WorkorderTime ON Rep.RepID = WorkorderTime.RepId
GROUP BY Rep.FirstName, Month([WorkOrderDate])
HAVING (((Month([WorkOrderDate]))=Month(Date())));

SELECT DISTINCTROW Rep.FirstName, Sum(WorkorderTime.WorkOrderTime) AS [Sum Of WorkOrderTime]
FROM Rep RIGHT JOIN WorkorderTime ON Rep.RepID = WorkorderTime.RepId
GROUP BY Rep.FirstName, Month([WorkOrderDate])
HAVING (((Month([WorkOrderDate]))=Month(Date())-1));
 
Old September 5th, 2006, 06:53 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Can't you do this:

HAVING (((Month([WorkOrderDate]))=Month(Date())) OR ((Month([WorkOrderDate]))=Month(Date()));



mmcdonal
 
Old September 27th, 2006, 08:51 AM
Authorized User
 
Join Date: Jan 2006
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Default

  try this

HAVING (((Month([WorkOrderDate]))=Month(Date())) and ((Month([WorkOrderDate]))=Month(Date()));









Similar Threads
Thread Thread Starter Forum Replies Last Post
display all dates within months sanjeev jha Classic ASP Basics 1 June 6th, 2008 12:46 PM
Sql Query to generate months and year arul1984 SQL Server 2000 8 July 23rd, 2007 04:42 PM
Query to get project numbers prashar SQL Language 1 December 13th, 2005 02:10 AM
A Problem of Query Numbers studenttwok PHP How-To 4 August 18th, 2003 01:40 PM
Simple Query/Display ABATES VS.NET 2002/2003 1 August 10th, 2003 05:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.