Access 2007
Existing Data Base:
In performing a Query of a data base that has a field that is Date/Time set to Medium Date, this field has dates that cover multiple years and all months of the year. The field needs to be set to Medium Date to comply with other reports that are required to do.
Problem:
In using this field, how do I separate out only the January or June or December month for a report [having multiple years is no a problem]?
In using this field, how do I separate out a month of a specific year {ex: January, 2009 or May, 2008}?
I want to Thank each individual that responds in advance for their help with this problem.
Last edited by Autin; 12-07-2011 at 02:25 PM.
To select all records in a certain month:# will be the number of the month (1 for Jan, 2 for Feb, etc.)SELECT * FROM tablename WHERE MONTH(datefield) = #;
To select all records in a certain month and a certain year:SELECT * FROM tablename WHERE MONTH(datefield) = # AND YEAR(datefield) = ####;
Is your code running too slowly?
Does your workbook or database have a bunch of duplicate pieces of data?
Have a look at this article to learn the best ways to set up your projects.
It will save both time and effort in the long run!
Dave
davegugg
Thanks for the information
Only question is where do I place the query code that you described?
many thanks
I assumed you had an existing query set up. If not, you'll have to create a new one.
Is your code running too slowly?
Does your workbook or database have a bunch of duplicate pieces of data?
Have a look at this article to learn the best ways to set up your projects.
It will save both time and effort in the long run!
Dave
davegugg
I got it to work.
I want to THANK YOU in advance for your assistance with this problem.
Autin
Last edited by Autin; 12-10-2011 at 12:35 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks