Results 1 to 4 of 4
  1. #1
    louise is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Apr 2015
    Posts
    112

    criteria with start date as month and year

    Hello,
    I need to specify a criteria in my query that sets the beginning of the date range as greater than/equal to a (constant) month (9, Sept -- always Sept.) and then prompts for the beginning year. The end of the date range is the present (Date() ) For example, to include all records after 9/1/ ...[enter the year].

    I have tried various DatePart approaches, but everything I try results in limiting the months for all subsequent years as well. Whereas I want the entire year after that starting point. And, I am not able to set the parameter right into the date, >=#9/1/[What Year?]#



    My field is ExpirationDate, a time/date field.

    Any help would be much appreciated!

  2. #2
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    Try >=CDate("09/01/" & [What year?])

  3. #3
    louise is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Apr 2015
    Posts
    112
    Hi,
    Thank you so much! I didn't know about the CDate function. I'm sure it will be useful in the future.
    Can you now give me a lead on how to insert that "chosen" [What Year?] into a text box in the header of the report?
    Thanks

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I NEVER use dynamic parameter popups in query - can't validate the input.

    Better to use a form for the input. Then the report can reference the form control as parameter input:

    >=CDate("9/1/" & Forms!formname!controlname)

    And textbox on report can have expression: =CDate("9/1/" & Forms!formname!controlname)
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Add date to table at start of each month
    By DubCap01 in forum Access
    Replies: 7
    Last Post: 06-20-2015, 01:54 AM
  2. Month and Year criteria
    By vickster3659 in forum Queries
    Replies: 6
    Last Post: 09-24-2014, 07:52 AM
  3. Replies: 4
    Last Post: 05-26-2013, 03:28 PM
  4. Parameter with Month & Year Criteria
    By Huddle in forum Access
    Replies: 3
    Last Post: 10-24-2012, 01:20 PM
  5. Replies: 1
    Last Post: 12-09-2005, 10:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums