Solved

Query DateField Return all records within a 1 month period

Posted on 2004-04-28
3
414 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of utilizing SQL Server functions 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 Ac…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

773 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