Results 1 to 2 of 2

Thread: datepart (2000)

  1. #1
    2 Star Lounger
    Join Date
    Mar 2004
    Location
    Christchurch
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    datepart (2000)

    Hi, I currently have a date dialog form that filters reports by a date range. The default values are related to a financial year and I have them hard coded as "01/07/2003" and "30/06/2004" (dd mm yyyy format in this country). I would like to use the datepart function to change this so that each year I don't have to change the default values, and instead the year is taken from this year (and this year -1) via datepart. I can populate the control on the form with the correct date with these:
    "30/06" & DatePart("yyyy",Now())
    "01/07" & (DatePart("yyyy",Now()))-1

    However this results in there being no data in the report, whereas previously using the old method there is data. Can anyone tell me what I am doing wrong?

    Regards
    Roger

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: datepart (2000)

    You have to add a / after the month :
    "30/06/" & DatePart("yyyy",Now())
    "01/07/" & (DatePart("yyyy",Now()))-1
    If this is still not returning the data (the result of your function is a string) try :
    DateSerial(Year(Now), 6, 30)
    DateSerial(Year(Now) - 1, 7, 1)
    Francois

Posting Permissions

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