Need to return first day (Sunday) of the week in format mm/dd/yy

  • Thread starter Thread starter SusanJ
  • Start date Start date
U¿ytkownik "SusanJ said:
Thanks for your help.


Public Function getSunday(iYear, iWeek) As Date
Dim d As Date
d = DateSerial(iYear, 1, 1) + (iWeek - 1) * 7
getSunday = d - Weekday(d) + 1
End Function

K.P.
www.access.vis.pl
 
I don't write code. Isn't there a function I can use in a query? Like
DatePart?
 
You write this function in common module and use it like DatePart or any
other built-in function:

SELECT getSunday(FieldYear, FieldWeek)
FROM Table1

K.P.
 

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