Format a date field in a query

P

Pearl

I am trying to create a query that includes only the month and year of a date
field. The date field has monthy/day/year as 10/02/1999 but I want to
create a query so that when I use that query to create a chart form, it will
use only the Month and year of the date field (i.e. 10/1999). That way, I
can set the month/year on the Y axis of my chart. How do I do this?
 
P

pietlinden

I am trying to create a query that includes only the month and year of a date
field.  The date field has   monthy/day/year as  10/02/1999 but I want to
create a query so that when I use that query to create a chart form, it will
use only the Month and year of the date field (i.e. 10/1999).  That way, I
can set the month/year on the Y axis of my chart.  How do I do this?

SELECT Month([ADateField]) As MonthOfDate, Select Year([ADateField])
As YearOfDate
FROM MyTable
WHERE....
 
J

John W. Vinson

I am trying to create a query that includes only the month and year of a date
field. The date field has monthy/day/year as 10/02/1999 but I want to
create a query so that when I use that query to create a chart form, it will
use only the Month and year of the date field (i.e. 10/1999). That way, I
can set the month/year on the Y axis of my chart. How do I do this?

You'll need the full date for criteria and for sorting, but you can include a
calculated field:

ShowDate: Format([datefield], "mm/yyyy")

to display on the chart.
 

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