Solved

Query DateField Return all records within a 1 month period

Posted on 2004-04-28
3
412 Views
Last Modified: 2012-05-04
I have a date field in my database, and i want to be able to run a query that will return any record for  the month i select,

is there a way to  read just the month from the datefield and return just that month

I dont want to use the between command,

date format is mm/dd/yy

I am a beginner with Access, but know my way around, just need some help.

Thanks

0
Comment
Question by:beeernpizza
3 Comments
 
LVL 6

Accepted Solution

by:
nathaniel earned 50 total points
ID: 10946076
other way around is:

Field    : Month([dateField])
Table   :
Sort     :
Show   :
Criteria: 1

to extract the month of January.
0
 

Author Comment

by:beeernpizza
ID: 10946198
This Works great just what i was looking for.

Thanks .
0
 
LVL 16

Expert Comment

by:ahmedbahgat
ID: 10946227
how about the year?

for example if you select the  month   Jan

which records you want to include records


01/01/2004


01/01/2010


so if yoy want all records by month, do you care what year, or you need to include all records with the same month period

if it is the month only and you do not care about the year, then create a form to select what month you want, remeber that access understands months as 1,2,3,4,5,6,7,8,9,10,11,12  and not Jan, Feb........

so your criteria for the month must be in numbers and not words, so if you have a textbox on your form called "MyMonth". then add a new column to your query like this

Exp: Month([MyDateField])

in front of the criteria for that new column we added, add the following:  Forms!MyForm!MyMonth

if you care about the year, then you have 2 options:

1. records within the current year
2. records with a year you select, in addition to the month

so add a new column to your query next to the one we added, it should look like:

Exp1:  Year([MyDateField])

 in front of the criteria for that new column we added, add the following:  Forms!MyForm!MyYear

and MyYear should be another textbox on your form, where you will type the year

if you want the current year only, then you do  not need to enter a year in your form but the second column we added will look like:

Exp1:  Year([MyDateField])

 in front of the criteria for that new column we added, add the following:  Year(Date())

cheers


0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Combobox issue 4 25
Error compiling fairly simple database 3 16
ms/access report does not open query 20 33
How calculate median 5 38
Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now