Results 1 to 3 of 3
  1. #1
    user622 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Posts
    6

    Query criteria from form (just the year)

    I have a query set up that it gets its input for criteria from a form. one of the criteria is a year, the problem im having is that it is a date field in the table, but all I want to filter is the year.



    example of what I need:

    input on form - 2008
    date field on query - 5/15/2008
    6/4/2008
    6/23/2008 ...etc.

    I'm sure its an easy fix but I'm new at this stuff and am looking for all the help I can get.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    create a field in your query:

    SearchYear: datepart("yyyy", <datefieldname>)

    Then use the criteria you're entering from your form

    forms!<formname>!<fieldnameonform>

  3. #3
    user622 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Posts
    6
    Thanks! worked like a charm.

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

Similar Threads

  1. Replies: 2
    Last Post: 07-12-2011, 07:53 PM
  2. Using Form Variable in Query Criteria
    By Greg.Terry in forum Queries
    Replies: 3
    Last Post: 04-01-2011, 08:06 PM
  3. Query Won't Accept Criteria from Form
    By Xiaoding in forum Queries
    Replies: 3
    Last Post: 11-30-2010, 01:51 PM
  4. Query criteria in a form
    By sefiroths in forum Queries
    Replies: 1
    Last Post: 12-23-2009, 05:15 AM
  5. using form's control as criteria in a query
    By brandonb in forum Access
    Replies: 0
    Last Post: 06-09-2009, 02:52 PM

Tags for this Thread

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