Populate Week Number into text box based on date selection

Hi Everyone,

Can anyone tell me how I would code a form to populate a text box based on a date selection in the calandar?  Do I have to pupulate two fields; one for the date picked and a second which is an evaluation of the date to derive the week number (1-52)?

Thanks,

MC
MCaliebeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeCommented:

Assuming you have a data field [SomeDate] in the recordset that is the record source for your form, and that you have a control (txt_SomeDate) which is bound to that date field, you could set the control source of an unbound control (txt_Week) to:

=datepart("ww", [SomeDate])

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
?datepart("ww", #12-25-2011#)
 53
 53 weeks this year ?

mx
0
Jeffrey CoachmanMIS LiasonCommented:
Yep, ...if the first day of the weeks is set as Sunday (which coincidentally Xmas happens to fall on this year...)
(If Monday is set as the first day, then its 52 weeks)
untitled.JPG
0
MCaliebeAuthor Commented:
I was not able to determine a way of useing the calendar to pick a date and have the text box result return the week number, however I did make good use of picking the date and pupluating another text box with the "ww" week# using the After Update action.  I decided to use the initial date box for evaluating the day of the week picked as well so this is acceptable.

Thanks,
MC
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.