Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count dates no matter what year

Status
Not open for further replies.

seashore67

Technical User
May 27, 2003
51
US
I'm attempting to make a count query of different groups of months. For example, July 1st thru Sept 30th. How can I do this without putting in a year for the query.

Thanks
Andrew
 

[tt]
Select Month(myDateField), Count(*) As NumberOfRecords
From tbl
Group By Month(myDateField)
[/tt]
 
Thank you for your help. Works marvelously!

Andrew
 
I have another question though. Is it possible to pop up a message box of some sort to ask the user what year?

Thanks again,
Andrew
 
Sure
[tt]
Select Month(myDateField), Count(*) As NumberOfRecords
From tbl
Where Year(myDateField) = [Enter the Year]
Group By Month(myDateField)
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top