Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WeekNo of a date

Status
Not open for further replies.

Samulayo

Programmer
Aug 13, 2002
46
GB
I'm creating a timesheet database and the entry of a new timesheet requires the date and week number that the timesheet corresponds to. I know how to find the week for the current date using
=Format(Now(),"ww")
but i would like the week number for the date entered to be the control for this value instead. ie something along the lines of
=Format([date],"ww")
where [date] is the field 'date' on the table (btw that does not work as life's not so simple.)
and help with this would be greatly appreciated.

Regards

Samulayo
 
Sorry about this, just to make things clear, i wanted this value to be in the 'default value' of a field
 
I am a little confused - If you are entering your data from a form, why don't you create an event procedure in the after update event of the "date" field that updates your "weeknumber" field.

Something like:

Private Sub date_AfterUpdate()
Me.weeknumber = Format([date], "ww")

End Sub

Hope that helps.

Fred
 
Fred,
I eventually used this approach after realising that something similar tot he above sub would make more sence. Thanks anyway

Regards
Samulayo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top