Help on Date Day problem

  • Thread starter Thread starter nigel bate
  • Start date Start date
N

nigel bate

What I need is a way of have the day of a short date put into another
textbox. At the moment when I copy the date to the text box the dd/mm//yy
comes with it, which I don't want, as when I click the field th date is
diplayed when dddd is used. I need to use the day as a search field instead
of using dates. I have try'd the following to no avail.
Dim MyDate, MyDay
MyDate = Me![txtDay] Assign a date.
Me![MyDay] = Day(MyDate)

Please help

Thanks in advance
Nigel
 
All examples use today's date 10/10/2005
If you want the spelled out name of the day:
=Format(Date,"dddd") will return Monday
If you want the abbreviation for the day:
=Format(Date,"ddd") will return Mon
If you want the day of the week as a number:
=WeekDay(Date) will return 2 because the default for the first day of the
week is Sunday.
If you want the week to start with Monday returning a 1:
=WeekDay(Date, vbMonday)
 
Doug,
I initially get the day i.e. Monday, but if I click on the field the
date appears. Also I need the day corresponding to the date to be saved
through to a table,(at the moment the date is saved). I am using queries
throughout my DB.
Nigel

Douglas J. Steele said:
What do you get with what you're using?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



nigel bate said:
What I need is a way of have the day of a short date put into another
textbox. At the moment when I copy the date to the text box the dd/mm//yy
comes with it, which I don't want, as when I click the field th date is
diplayed when dddd is used. I need to use the day as a search field
instead of using dates. I have try'd the following to no avail.
Dim MyDate, MyDay
MyDate = Me![txtDay] Assign a date.
Me![MyDay] = Day(MyDate)

Please help

Thanks in advance
Nigel
 
Klatuu,
Thank you. What I need, is the day to be saved (not just displayed) as
the day corresponding to a date (not the date itself), this day is then to
be saved to a table.
Nigel

Klatuu said:
All examples use today's date 10/10/2005
If you want the spelled out name of the day:
=Format(Date,"dddd") will return Monday
If you want the abbreviation for the day:
=Format(Date,"ddd") will return Mon
If you want the day of the week as a number:
=WeekDay(Date) will return 2 because the default for the first day of the
week is Sunday.
If you want the week to start with Monday returning a 1:
=WeekDay(Date, vbMonday)

nigel bate said:
What I need is a way of have the day of a short date put into another
textbox. At the moment when I copy the date to the text box the dd/mm//yy
comes with it, which I don't want, as when I click the field th date is
diplayed when dddd is used. I need to use the day as a search field
instead
of using dates. I have try'd the following to no avail.
Dim MyDate, MyDay
MyDate = Me![txtDay] Assign a date.
Me![MyDay] = Day(MyDate)

Please help

Thanks in advance
Nigel
 
Douglas,
Further, I need the day so that I can pull all records, say for a Monday
between 2 dates. This could mean 4 for a month or12 for a 3 monthly period,
thus analysing records on given days of a week. Strange I know but this is
what has been requested.

Thank You
Nigel
Douglas J. Steele said:
What do you get with what you're using?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



nigel bate said:
What I need is a way of have the day of a short date put into another
textbox. At the moment when I copy the date to the text box the dd/mm//yy
comes with it, which I don't want, as when I click the field th date is
diplayed when dddd is used. I need to use the day as a search field
instead of using dates. I have try'd the following to no avail.
Dim MyDate, MyDay
MyDate = Me![txtDay] Assign a date.
Me![MyDay] = Day(MyDate)

Please help

Thanks in advance
Nigel
 
When you say "day corresponding to a date", what do you mean. It could be
"Monday", "Mon", a number from 1 to 7 depending on what you identify as the
first day of the week, or it could be a Julian date. We have to know
specifically what you want. Once we know in what form you want your data,
then writing it to a table should be no problem.

nigel bate said:
Klatuu,
Thank you. What I need, is the day to be saved (not just displayed) as
the day corresponding to a date (not the date itself), this day is then to
be saved to a table.
Nigel

Klatuu said:
All examples use today's date 10/10/2005
If you want the spelled out name of the day:
=Format(Date,"dddd") will return Monday
If you want the abbreviation for the day:
=Format(Date,"ddd") will return Mon
If you want the day of the week as a number:
=WeekDay(Date) will return 2 because the default for the first day of the
week is Sunday.
If you want the week to start with Monday returning a 1:
=WeekDay(Date, vbMonday)

nigel bate said:
What I need is a way of have the day of a short date put into another
textbox. At the moment when I copy the date to the text box the dd/mm//yy
comes with it, which I don't want, as when I click the field th date is
diplayed when dddd is used. I need to use the day as a search field
instead
of using dates. I have try'd the following to no avail.
Dim MyDate, MyDay
MyDate = Me![txtDay] Assign a date.
Me![MyDay] = Day(MyDate)

Please help

Thanks in advance
Nigel
 
Your query should have a computed field in it that indicates the weekday
(use the Weekday function: it should return 1 for Sunday, 2 for Monday and
so on to 7 for Saturday). You can then use that computed field in your WHERE
clause.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



nigel bate said:
Douglas,
Further, I need the day so that I can pull all records, say for a
Monday between 2 dates. This could mean 4 for a month or12 for a 3 monthly
period, thus analysing records on given days of a week. Strange I know but
this is what has been requested.

Thank You
Nigel
Douglas J. Steele said:
What do you get with what you're using?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



nigel bate said:
What I need is a way of have the day of a short date put into another
textbox. At the moment when I copy the date to the text box the
dd/mm//yy comes with it, which I don't want, as when I click the field
th date is diplayed when dddd is used. I need to use the day as a search
field instead of using dates. I have try'd the following to no avail.
Dim MyDate, MyDay
MyDate = Me![txtDay] Assign a date.
Me![MyDay] = Day(MyDate)

Please help

Thanks in advance
Nigel
 
Klatuu,
I would like the day for example "Monday" for a given date. If I entered
14 October 2005 in a date field, I would like the corresponding day in this
Friday to be in another field for it to be entered into a table as the day
"Friday" without the date link.
Hope this makes sense
Nigel
Klatuu said:
When you say "day corresponding to a date", what do you mean. It could be
"Monday", "Mon", a number from 1 to 7 depending on what you identify as
the
first day of the week, or it could be a Julian date. We have to know
specifically what you want. Once we know in what form you want your data,
then writing it to a table should be no problem.

nigel bate said:
Klatuu,
Thank you. What I need, is the day to be saved (not just displayed)
as
the day corresponding to a date (not the date itself), this day is then
to
be saved to a table.
Nigel

Klatuu said:
All examples use today's date 10/10/2005
If you want the spelled out name of the day:
=Format(Date,"dddd") will return Monday
If you want the abbreviation for the day:
=Format(Date,"ddd") will return Mon
If you want the day of the week as a number:
=WeekDay(Date) will return 2 because the default for the first day of
the
week is Sunday.
If you want the week to start with Monday returning a 1:
=WeekDay(Date, vbMonday)

:

What I need is a way of have the day of a short date put into another
textbox. At the moment when I copy the date to the text box the
dd/mm//yy
comes with it, which I don't want, as when I click the field th date
is
diplayed when dddd is used. I need to use the day as a search field
instead
of using dates. I have try'd the following to no avail.
Dim MyDate, MyDay
MyDate = Me![txtDay] Assign a date.
Me![MyDay] = Day(MyDate)

Please help

Thanks in advance
Nigel
 
Thanks Douglas, I shall try it,
Nigel
Douglas J. Steele said:
Your query should have a computed field in it that indicates the weekday
(use the Weekday function: it should return 1 for Sunday, 2 for Monday and
so on to 7 for Saturday). You can then use that computed field in your
WHERE clause.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



nigel bate said:
Douglas,
Further, I need the day so that I can pull all records, say for a
Monday between 2 dates. This could mean 4 for a month or12 for a 3
monthly period, thus analysing records on given days of a week. Strange I
know but this is what has been requested.

Thank You
Nigel
Douglas J. Steele said:
What do you get with what you're using?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



What I need is a way of have the day of a short date put into another
textbox. At the moment when I copy the date to the text box the
dd/mm//yy comes with it, which I don't want, as when I click the field
th date is diplayed when dddd is used. I need to use the day as a
search field instead of using dates. I have try'd the following to no
avail.
Dim MyDate, MyDay
MyDate = Me![txtDay] Assign a date.
Me![MyDay] = Day(MyDate)

Please help

Thanks in advance
Nigel
 
Douglas,
I have never try'd this type of query before. Can I pick you brains, and
ask for the Computed code for the query please.
Thank you
Nigel
Douglas J. Steele said:
Your query should have a computed field in it that indicates the weekday
(use the Weekday function: it should return 1 for Sunday, 2 for Monday and
so on to 7 for Saturday). You can then use that computed field in your
WHERE clause.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



nigel bate said:
Douglas,
Further, I need the day so that I can pull all records, say for a
Monday between 2 dates. This could mean 4 for a month or12 for a 3
monthly period, thus analysing records on given days of a week. Strange I
know but this is what has been requested.

Thank You
Nigel
Douglas J. Steele said:
What do you get with what you're using?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



What I need is a way of have the day of a short date put into another
textbox. At the moment when I copy the date to the text box the
dd/mm//yy comes with it, which I don't want, as when I click the field
th date is diplayed when dddd is used. I need to use the day as a
search field instead of using dates. I have try'd the following to no
avail.
Dim MyDate, MyDay
MyDate = Me![txtDay] Assign a date.
Me![MyDay] = Day(MyDate)

Please help

Thanks in advance
Nigel
 
In an empty column in the query builder, put WhatDay: Weekday([MyDateField])

(replace MyDateField with whatever the name of your date field actuall is,
but leave the WhatDay: unchanged)

In the criteria row under that, put the weekday in which you're interested
(number between 1 and 7)

Alternatively, you could use WhatDay: Format([MyDateField], "ddd") and use
Sun, Mon, Tue, ..., Sat for the criteria, or WhatDay: Format([MyDateField],
"dddd") and use Sunday, Monday, Tuesday, ..., Saturday. However these aren't
considered as good an idea, since you can run into problems if the user is
using a different language.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


nigel bate said:
Douglas,
I have never try'd this type of query before. Can I pick you brains, and
ask for the Computed code for the query please.
Thank you
Nigel
Douglas J. Steele said:
Your query should have a computed field in it that indicates the weekday
(use the Weekday function: it should return 1 for Sunday, 2 for Monday and
so on to 7 for Saturday). You can then use that computed field in your
WHERE clause.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



nigel bate said:
Douglas,
Further, I need the day so that I can pull all records, say for a
Monday between 2 dates. This could mean 4 for a month or12 for a 3
monthly period, thus analysing records on given days of a week. Strange I
know but this is what has been requested.

Thank You
Nigel
What do you get with what you're using?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



What I need is a way of have the day of a short date put into another
textbox. At the moment when I copy the date to the text box the
dd/mm//yy comes with it, which I don't want, as when I click the field
th date is diplayed when dddd is used. I need to use the day as a
search field instead of using dates. I have try'd the following to no
avail.
Dim MyDate, MyDay
MyDate = Me![txtDay] Assign a date.
Me![MyDay] = Day(MyDate)

Please help

Thanks in advance
Nigel
 
Douglas,
Thanks a million - it worked a treat!

Nigel

Douglas J Steele said:
In an empty column in the query builder, put WhatDay:
Weekday([MyDateField])

(replace MyDateField with whatever the name of your date field actuall is,
but leave the WhatDay: unchanged)

In the criteria row under that, put the weekday in which you're interested
(number between 1 and 7)

Alternatively, you could use WhatDay: Format([MyDateField], "ddd") and use
Sun, Mon, Tue, ..., Sat for the criteria, or WhatDay:
Format([MyDateField],
"dddd") and use Sunday, Monday, Tuesday, ..., Saturday. However these
aren't
considered as good an idea, since you can run into problems if the user is
using a different language.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


nigel bate said:
Douglas,
I have never try'd this type of query before. Can I pick you brains, and
ask for the Computed code for the query please.
Thank you
Nigel
Douglas J. Steele said:
Your query should have a computed field in it that indicates the
weekday
(use the Weekday function: it should return 1 for Sunday, 2 for Monday and
so on to 7 for Saturday). You can then use that computed field in your
WHERE clause.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Douglas,
Further, I need the day so that I can pull all records, say for a
Monday between 2 dates. This could mean 4 for a month or12 for a 3
monthly period, thus analysing records on given days of a week.
Strange I
know but this is what has been requested.

Thank You
Nigel
What do you get with what you're using?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



What I need is a way of have the day of a short date put into
another
textbox. At the moment when I copy the date to the text box the
dd/mm//yy comes with it, which I don't want, as when I click the field
th date is diplayed when dddd is used. I need to use the day as a
search field instead of using dates. I have try'd the following to
no
avail.
Dim MyDate, MyDay
MyDate = Me![txtDay] Assign a date.
Me![MyDay] = Day(MyDate)

Please help

Thanks in advance
Nigel
 
Back
Top