Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2005
    Location
    New England
    Posts
    35

    Unanswered: Displaying dates

    I have a report that gets printed out on Monday mornings. It has the days of the week already filled in for that week using Date(), Date()+1, etc. This works ok, however occasionally we need to print out the report during the week, however still need it to display the dates starting with Mon. Is there an expression (or VBA) that would evaluate the date and put in the preceding Monday's date? Thanks.

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi


    Some code I use to get the Sun and Mon dates before and after the date entered:

    Code:
    Sub sSQLFirstDayOfWk(datMidWk As Date, ByRef datFirstDayOfWk As Date, ByRef datLastDayOfWk As Date)
    	
    	Dim intDaysBack As Integer
    	
    	intDaysBack = WeekDay(datMidWk, vbMonday) - 1
    	
    	datFirstDayOfWk = datMidWk
    	datFirstDayOfWk = DateAdd("d", -intDaysBack, datFirstDayOfWk)
    	
    	datLastDayOfWk = DateAdd("d", 7, datFirstDayOfWk)
    
    End Sub
    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

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