With week number calculated week days

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi!

I have in form a textbox with Date (11-Nov-06).
In another textbox, the week number (45).
I would like in more textboxes, to show weekdays of this week:
Sunday, Monday, ...

Is it possible, please?
Thanks in advance.
an
 
Hi!

I have in form a textbox with Date (11-Nov-06).
In another textbox, the week number (45).
I would like in more textboxes, to show weekdays of this week:
Sunday, Monday, ...

Is it possible, please?
Thanks in advance.
an

What do you want to do with these textboxes? Store the seven dates in
a table (probably a very bad idea)? Just display the date? or what? Of
the two textboxes you now have, which is "real data" and which is
derived? You can have just one date field and display it with a
"dd-mmm-yy" format or a "ww" format to get the effect above; surely
you're not storing both a date and an integer?

John W. Vinson[MVP]
 
Now, I have txtToday with Date() in Default Value, and txtWeek based in
txtToday with DatePart("ww";[txtToday]).
I don't need store the seven dates in a table because save only week number.
I would like to show the dates, based in week number, only for information
on the form.

Thank you.
an
 
Now, I have txtToday with Date() in Default Value, and txtWeek based in
txtToday with DatePart("ww";[txtToday]).
I don't need store the seven dates in a table because save only week number.
I would like to show the dates, based in week number, only for information
on the form.

ok... set the Control Sources of the seven controls to

=DateAdd("d", 7 - Weekday([txtToday]), Date())
=DateAdd("d", 6 - Weekday([txtToday]), Date())
=DateAdd("d", 5 - Weekday([txtToday]), Date())
=DateAdd("d", 4 - Weekday([txtToday]), Date())
=DateAdd("d", 3 - Weekday([txtToday]), Date())
=DateAdd("d", 2 - Weekday([txtToday]), Date())
=DateAdd("d", 1 - Weekday([txtToday]), Date())

to get Sunday's through Saturday's dates. You may need to play with
the numbers, this is untested code.

John W. Vinson[MVP]
 
Exactly.
Work fine.
Thank you.
an

John Vinson said:
Now, I have txtToday with Date() in Default Value, and txtWeek based in
txtToday with DatePart("ww";[txtToday]).
I don't need store the seven dates in a table because save only week number.
I would like to show the dates, based in week number, only for information
on the form.

ok... set the Control Sources of the seven controls to

=DateAdd("d", 7 - Weekday([txtToday]), Date())
=DateAdd("d", 6 - Weekday([txtToday]), Date())
=DateAdd("d", 5 - Weekday([txtToday]), Date())
=DateAdd("d", 4 - Weekday([txtToday]), Date())
=DateAdd("d", 3 - Weekday([txtToday]), Date())
=DateAdd("d", 2 - Weekday([txtToday]), Date())
=DateAdd("d", 1 - Weekday([txtToday]), Date())

to get Sunday's through Saturday's dates. You may need to play with
the numbers, this is untested code.

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

Back
Top