Sort Date by day of week, not year.

S

Sky

Hello,

Is there a way to force Access 2000 to sort the Date by
the day of week, instead of by year. I have a query that
returns birthdays by month, and I want them sorted by the
day of week. Is there a way to do this.
 
K

Ken Snell

Add a calculated field to your query:
DayOfWeek: DatePart("w", [DateFieldName])

This function returns 1 for Sunday, 2 for Monday, etc. You can then sort on
it.

Or, if you want to sort by the name of the day of the week, add a calculated
field to your query:
DayOfWeek: Format([DateFieldName], "dddd")
 
S

Sky

Ken,

Both suggestions worked flawlessly and I
-----Original Message-----
Add a calculated field to your query:
DayOfWeek: DatePart("w", [DateFieldName])

This function returns 1 for Sunday, 2 for Monday, etc. You can then sort on
it.

Or, if you want to sort by the name of the day of the week, add a calculated
field to your query:
DayOfWeek: Format([DateFieldName], "dddd")
--
Ken Snell
<MS ACCESS MVP>

Sky said:
Hello,

Is there a way to force Access 2000 to sort the Date by
the day of week, instead of by year. I have a query that
returns birthdays by month, and I want them sorted by the
day of week. Is there a way to do this.


.
 
S

Sky

Ken,

Ooops! Hit a key by accident so didn't finish reply.
Anyway, the two suggestions work but I wonder if it's
possible to have both the Month and Day appear and be
sorted by the Day.

If not, I'll settle for what I have. At any rate, thanks
Ken for giving me some life here. Your knowledge is
invaluable!!!


-----Original Message-----
Add a calculated field to your query:
DayOfWeek: DatePart("w", [DateFieldName])

This function returns 1 for Sunday, 2 for Monday, etc. You can then sort on
it.

Or, if you want to sort by the name of the day of the week, add a calculated
field to your query:
DayOfWeek: Format([DateFieldName], "dddd")
--
Ken Snell
<MS ACCESS MVP>

Sky said:
Hello,

Is there a way to force Access 2000 to sort the Date by
the day of week, instead of by year. I have a query that
returns birthdays by month, and I want them sorted by the
day of week. Is there a way to do this.


.
 
K

Ken Snell

If you want to show the Month and Day as separate fields in the query,
simply create another calculated field in the query:
MonthName: Format([DateFieldName], "mmmm")

--
Ken Snell
<MS ACCESS MVP>

Sky said:
Ken,

Ooops! Hit a key by accident so didn't finish reply.
Anyway, the two suggestions work but I wonder if it's
possible to have both the Month and Day appear and be
sorted by the Day.

If not, I'll settle for what I have. At any rate, thanks
Ken for giving me some life here. Your knowledge is
invaluable!!!


-----Original Message-----
Add a calculated field to your query:
DayOfWeek: DatePart("w", [DateFieldName])

This function returns 1 for Sunday, 2 for Monday, etc. You can then sort on
it.

Or, if you want to sort by the name of the day of the week, add a calculated
field to your query:
DayOfWeek: Format([DateFieldName], "dddd")
--
Ken Snell
<MS ACCESS MVP>

Sky said:
Hello,

Is there a way to force Access 2000 to sort the Date by
the day of week, instead of by year. I have a query that
returns birthdays by month, and I want them sorted by the
day of week. Is there a way to do this.


.
 
S

Sky

Ken,

Great idea! It works like a charm. Your the best dude!

Thanks a zillion times over...

-Sky
-----Original Message-----
If you want to show the Month and Day as separate fields in the query,
simply create another calculated field in the query:
MonthName: Format([DateFieldName], "mmmm")

--
Ken Snell
<MS ACCESS MVP>

Sky said:
Ken,

Ooops! Hit a key by accident so didn't finish reply.
Anyway, the two suggestions work but I wonder if it's
possible to have both the Month and Day appear and be
sorted by the Day.

If not, I'll settle for what I have. At any rate, thanks
Ken for giving me some life here. Your knowledge is
invaluable!!!


-----Original Message-----
Add a calculated field to your query:
DayOfWeek: DatePart("w", [DateFieldName])

This function returns 1 for Sunday, 2 for Monday, etc. You can then sort on
it.

Or, if you want to sort by the name of the day of the week, add a calculated
field to your query:
DayOfWeek: Format([DateFieldName], "dddd")
--
Ken Snell
<MS ACCESS MVP>

Hello,

Is there a way to force Access 2000 to sort the Date by
the day of week, instead of by year. I have a query that
returns birthdays by month, and I want them sorted
by
the
day of week. Is there a way to do this.




.


.
 
K

Ken Snell

You're welcome.

Sky said:
Ken,

Great idea! It works like a charm. Your the best dude!

Thanks a zillion times over...

-Sky
-----Original Message-----
If you want to show the Month and Day as separate fields in the query,
simply create another calculated field in the query:
MonthName: Format([DateFieldName], "mmmm")

--
Ken Snell
<MS ACCESS MVP>

Sky said:
Ken,

Ooops! Hit a key by accident so didn't finish reply.
Anyway, the two suggestions work but I wonder if it's
possible to have both the Month and Day appear and be
sorted by the Day.

If not, I'll settle for what I have. At any rate, thanks
Ken for giving me some life here. Your knowledge is
invaluable!!!



-----Original Message-----
Add a calculated field to your query:
DayOfWeek: DatePart("w", [DateFieldName])

This function returns 1 for Sunday, 2 for Monday, etc.
You can then sort on
it.

Or, if you want to sort by the name of the day of the
week, add a calculated
field to your query:
DayOfWeek: Format([DateFieldName], "dddd")
--
Ken Snell
<MS ACCESS MVP>

Hello,

Is there a way to force Access 2000 to sort the Date by
the day of week, instead of by year. I have a query
that
returns birthdays by month, and I want them sorted by
the
day of week. Is there a way to do this.




.


.
 

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