Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2003
    Posts
    11

    Unanswered: Year number and Week number

    I wanted a text field to automatically diplay the week number when i typed in the date. see previous thread.

    http://www.dbforums.com/showthread.p...ghlight=pabtyf

    I used the method posted by cyberlynx.
    Me.week_no = Datepart("ww", CDate(Me.DateC)

    Now i would like to add the year number to that aswell, e.g 04/51 (yy/ww). can i modify this code (i have tried all i can think of) or do i need to start again?

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Why not : Format(CDate(MyFieldHere.Value),"mm/dd")

  3. #3
    Join Date
    Jan 2004
    Location
    Jersey, UK
    Posts
    108
    I think M Owen is right but if you need the year portion too then

    Me.week_no = Datepart("yy", CDate(Me.DateC) would get the year part you need. Then I assume you could just concatenate the two parts together: me.week_no = Datepart("ww", CDate(Me.DateC) & "/" & Datepart("yy", CDate(Me.DateC)


    Regards - Andy

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Originally posted by randycarpet
    I think M Owen is right but if you need the year portion too then

    Me.week_no = Datepart("yy", CDate(Me.DateC) would get the year part you need. Then I assume you could just concatenate the two parts together: me.week_no = Datepart("ww", CDate(Me.DateC) & "/" & Datepart("yy", CDate(Me.DateC)


    Regards - Andy
    Well actually I'm wrong ... AGAIN! You hit the button Andy.

  5. #5
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Originally posted by M Owen
    Why not : Format(CDate(MyFieldHere.Value),"mm/dd")
    CORRECTION : Try ... Format(CDate(MyFieldHere.Value),"yy/ww") This will give you the year and week combination desired ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •