How to have a date range equal a particular month

G

Guest

What is the expression for converting multiple dates mm/dd/yyyy to the
coinsiding month?
 
G

Guest

It is according to how you are going to use the data but try this --
Format([YourField], "yyyymm")
This will give you 200711 for this month.
Format([YourField], "mmmm yyyy")
This will give you November 2007 for this month.
 
J

John Spencer

Format(DateField, "yyyy-mm") as string 2007-11

or
Month(DateField) returns the month number and Year(DateField) returns the
year number
11 and 2007 in separate fields

Or to get a date field that is the first day of the month
DateSerial(Year(DateField),Month(DateField),1)
Nov 1, 2007 (US format: 11/1/2007)

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
G

Guest

Karl, This worked! Thank you very much!

KARL DEWEY said:
It is according to how you are going to use the data but try this --
Format([YourField], "yyyymm")
This will give you 200711 for this month.
Format([YourField], "mmmm yyyy")
This will give you November 2007 for this month.

--
KARL DEWEY
Build a little - Test a little


tvillare said:
What is the expression for converting multiple dates mm/dd/yyyy to the
coinsiding month?
 
J

John W. Vinson

What is the expression for converting multiple dates mm/dd/yyyy to the
coinsiding month?

One useful way to take an arbitrary date and convert it to criteria to search
for records within that month is to use a criterion such as
= DateSerial(Year([Enter date:]), Month([Enter date:], 1) AND < DateSerial(Year([Enter date:]), Month([Enter date:] + 1, 1)

Replace [Enter date:] by a form reference if that's what you're using as a
criterion.

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top