Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    330
    Thanks
    10
    Thanked 0 Times in 0 Posts

    How should this expression be written? (Acc2003 on

    I want to change the expression below so that it automatically picks the right years each year.

    >#1/072004# And <#1/07/2005#

    I tried this
    >"#1/07/" & (DatePart("yyyy",Now())-1) & "#" And <"#1/07/" & (DatePart("yyyy",Now())) & "#"

    but it errored : Data Type Mismatch Error in Criteria

    Thankyou for your help
    "Heading for the deep end"

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How should this expression be written? (Acc2003 on

    Try

    Between DateSerial(Year(Date())-1,7,1) And DateSerial(Year(Date()),6,30)

    Year(Date()) is the current year, and DateSerial takes arguments year, month, date (in that order).

  3. #3
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: How should this expression be written? (Acc2003 on

    Try using Year(Date())+1

    Where are you using this expression?

  4. #4
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    330
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: How should this expression be written? (Acc200

    It's part of a query to show hours for work still open from the last financial year, without having to remember each year that the dates need to be corrected. Thanks Hans, that was just as it needed to be.
    "Heading for the deep end"

Posting Permissions

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