Number of the actual week

J

johan

Hoi,

Can somebody help me out,
I need a module to registrate only the actual weeknumber in a
textfield.
I know the module for the date, the day and the year, but I can't find
it for only the week.

regards,
Johan
 
J

John W. Vinson

I know the module for the date, the day and the year, but I can't find
it for only the week.

DatePart("ww", [datefield], <optional arguments>)

Open the VBA editor, press F1, and search for help on DatePart (or Format,
they both will give you the week). There are various ways to define "the first
week" of the year - the week containing the first Sunday, the week containing
the first Tuesday, the first full week, etc.

John W. Vinson [MVP]
 
J

johan

Thanks, it works.
--------------------
Set Db = CurrentDb()
Set F = Forms![TEST]
m = DatePart("ww", Date)
F![Weeknr] = m
------------------------
 
J

John W. Vinson

Thanks, it works.
--------------------
Set Db = CurrentDb()
Set F = Forms![TEST]
m = DatePart("ww", Date)
F![Weeknr] = m

Or more simply, just set the Control Source of Weeknr to

=DatePart("ww", Date())

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

Top