[Last Call] Learn how to a build a cloud-first strategyRegister Now


How do I get all the dates that occured in a specifed month regardless of day or year?

Posted on 2014-08-02
Medium Priority
Last Modified: 2014-08-03
We want to pay our respects to horses that have died in a specific month.  So in my report, Horses that have Crossed Rainbow Bridge (died), I only want the names of the horses that died during the month of, say, August, regardless of day or year.
So what is the criteria in the datDateCrossedRainbowBridge column of the report's Record Source query?
Question by:bobbat
LVL 49

Assisted Solution

by:Dale Fye
Dale Fye earned 500 total points
ID: 40236821
SELECT * FROM yourTable
WHERE Month([datDateCrossedRainbowBridge]) = 8
LVL 31

Assisted Solution

hnasr earned 500 total points
ID: 40236994
WHERE FORMAT([datDateCrossedRainbowBridge],"mmmm")="August"

Open in new window

LVL 46

Assisted Solution

aikimark earned 1000 total points
ID: 40237524
If you are running this report for the current month:
SELECT * FROM HorsesTable
WHERE Month([datDateCrossedRainbowBridge]) = Month(Date)

Open in new window

If reporting on next month's horses
SELECT * FROM HorsesTable
WHERE Month([datDateCrossedRainbowBridge]) = (month(x) mod 12) + 1

Open in new window

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.


Author Comment

ID: 40237878
For Dale Fye and hnsar: Your SQL works, thanks.

For aikimark:  When I execute the report with Record Source of: SELECT * FROM tblHorses WHERE Month([datDateCrossedRainbowBridge]) = Month(Date)

I get a dialog box asking me ("Enter Parameter Value") for the "Date".  If I enter todays date or any date the report works.  I would like to be able to skip entering the date.  How can I do this?
LVL 46

Accepted Solution

aikimark earned 1000 total points
ID: 40237887
Either this:
SELECT * FROM tblHorses WHERE Month([datDateCrossedRainbowBridge]) = Month(Date())

Open in new window

or this:
SELECT * FROM tblHorses WHERE Month([datDateCrossedRainbowBridge]) = Month(Now)

Open in new window


Author Comment

ID: 40237978
That worked.  Access turns it into:
SELECT * FROM tblHorses
WHERE (((Month([datDateCrossedRainbowBridge]))=Month(Date())));

Thanks to all.

This report reminds us that in 2008 Point To Ponder was euthanized after screws securing the broken bone in her knee failed.
The tribute video is here: https://www.youtube.com/watch?v=hnQAlC7-vng

Author Closing Comment

ID: 40237981
Many thanks to everyone that helps us with the horses.  https://www.facebook.com/bhfer

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question