Solved

Query DateField Return all records within a 1 month period

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

726 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