Solved

Query DateField Return all records within a 1 month period

Posted on 2004-04-28
3
418 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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…
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…
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 …

705 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