Grouping on date field

  • Thread starter Thread starter Steve J
  • Start date Start date
You could create a column in your query and then group on it.

YearMon: Year([DateField]) & Month([DateField])
 
That's great dennis - thanks

is it possibl;e to format the month so that they are displayed in correct
order - persumably by adding a zero if konth number < 10

Dennis said:
You could create a column in your query and then group on it.

YearMon: Year([DateField]) & Month([DateField])

Steve J said:
I i need to group by month and year on a date field - is this possible
please?
S
 
Sorted !

Thanks
Steve J said:
That's great dennis - thanks

is it possibl;e to format the month so that they are displayed in correct
order - persumably by adding a zero if konth number < 10

Dennis said:
You could create a column in your query and then group on it.

YearMon: Year([DateField]) & Month([DateField])

Steve J said:
I i need to group by month and year on a date field - is this possible
please?
S
 
It may be quicker to use Tina's suggestion since her suggestion involves
only 1 VBA function execution while Dennis' suggestion involves 2 VBA
function executions, 2 type-casting processes (from numeric to Text) & the
concatenating process. This, of course, hardly noticeable if you have only
small number of Records.

Try Tina's suggestion but use the formating String "yyyymm" instead, i.e.

YearMonth: Format([MyDateField],"yyyymm")


--
HTH
Van T. Dinh
MVP (Access)



Steve J said:
That's great dennis - thanks

is it possibl;e to format the month so that they are displayed in correct
order - persumably by adding a zero if konth number < 10

Dennis said:
You could create a column in your query and then group on it.

YearMon: Year([DateField]) & Month([DateField])

Steve J said:
I i need to group by month and year on a date field - is this possible
please?
S
 
you're right, Van, yyyymm will allow for a better sort order, thanks for the
tweak! :)


Van T. Dinh said:
It may be quicker to use Tina's suggestion since her suggestion involves
only 1 VBA function execution while Dennis' suggestion involves 2 VBA
function executions, 2 type-casting processes (from numeric to Text) & the
concatenating process. This, of course, hardly noticeable if you have only
small number of Records.

Try Tina's suggestion but use the formating String "yyyymm" instead, i.e.

YearMonth: Format([MyDateField],"yyyymm")


--
HTH
Van T. Dinh
MVP (Access)



Steve J said:
That's great dennis - thanks

is it possibl;e to format the month so that they are displayed in correct
order - persumably by adding a zero if konth number < 10

Dennis said:
You could create a column in your query and then group on it.

YearMon: Year([DateField]) & Month([DateField])

:

I i need to group by month and year on a date field - is this possible
please?
S
 
Thanks everyone


tina said:
you're right, Van, yyyymm will allow for a better sort order, thanks for
the
tweak! :)


Van T. Dinh said:
It may be quicker to use Tina's suggestion since her suggestion involves
only 1 VBA function execution while Dennis' suggestion involves 2 VBA
function executions, 2 type-casting processes (from numeric to Text) &
the
concatenating process. This, of course, hardly noticeable if you have only
small number of Records.

Try Tina's suggestion but use the formating String "yyyymm" instead, i.e.

YearMonth: Format([MyDateField],"yyyymm")


--
HTH
Van T. Dinh
MVP (Access)



Steve J said:
That's great dennis - thanks

is it possibl;e to format the month so that they are displayed in correct
order - persumably by adding a zero if konth number < 10

You could create a column in your query and then group on it.

YearMon: Year([DateField]) & Month([DateField])

:

I i need to group by month and year on a date field - is this possible
please?
S
 
Back
Top