+ Reply to Thread
Results 1 to 2 of 2

Writing a Critera for my query

  1. #1
    Registered User
    Join Date
    01-20-2016
    Location
    Indiana
    MS-Off Ver
    2013
    Posts
    45

    Writing a Critera for my query

    Working with a large data set and need a way to make it more usable.


    Currently:
    I have it programmed at the start it asks me for the [Lake Name]

    After I type the lake name, I want to set it up to ask for the year of the survey. I want it to filter the surveys out by year, and not the exact date. Is there a way to write this in the criteria section?

    Query .jpg


    Example of the table I have:
    vaw_name samp_sampleID samp_startdate
    Sylvan 4325 7/5/1967
    Sylvan 4324 7/5/1967
    Sylvan 4322 7/5/1967
    Sylvan 4327 8/24/1967
    Sylvan 4330 7/20/1970
    Sylvan 4329 7/20/1970
    Sylvan 4328 7/20/1970
    Sylvan 4331 6/5/1978
    Sylvan 4335 6/11/1979
    Sylvan 2682 6/2/1980
    Sylvan 2687 6/1/1981
    Sylvan 2688 6/3/1985
    Sylvan 2689 9/10/1985
    Sylvan 2703 6/2/1986
    Sylvan 2706 8/25/1986
    Sylvan 2710 10/8/1986
    Sylvan 2712 10/7/1987
    Sylvan 2713 10/26/1987
    Sylvan 1033 6/3/1991
    Sylvan 1036 5/4/1993
    Sylvan 1038 5/18/1993
    Sylvan 1039 8/16/1994
    Sylvan 1040 6/3/1996



    What I want ( If I searched for 1967):

    vaw_name samp_sampleID samp_startdate
    Sylvan 4325 7/5/1967
    Sylvan 4324 7/5/1967
    Sylvan 4322 7/5/1967
    Sylvan 4327 8/24/1967

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Writing a Critera for my query

    Hi tsd,

    You need to build an expression in your query builder FIELD that filters out the year only.
    I have a large genealogy database with everyone's date of birth in a DOB field. If I want filter everyone who was born in 1955 I need to extract the year from the dob.

    In a field in the query builder my formula looks like this:

    Expr1: Year([People Table]![BIRTHDT])

    Then in the criteria field I would then put "1955"

    When I bang the filter it then only shows people who were born in 1955.

    read about "Access Expression Builder" at:
    https://msdn.microsoft.com/en-us/lib...or=-2147217396
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Having trouble writing a SELECT query
    By mc84excel in forum Access Tables & Databases
    Replies: 15
    Last Post: 03-23-2015, 08:19 PM
  2. SQL query writing
    By hom100 in forum Excel General
    Replies: 1
    Last Post: 01-10-2015, 03:33 AM
  3. Excel VBA to modify Access Query Critera?
    By ericbartha in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-23-2014, 09:20 AM
  4. [SOLVED] Help writing query that extracts numeric and alphanumeric information at same time
    By alcharbonneau in forum Access Tables & Databases
    Replies: 3
    Last Post: 03-04-2013, 03:39 PM
  5. Writing SQL query to import specific data to a pivot tableatabase
    By Richard Buttrey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-21-2008, 10:10 AM
  6. Problem in getting writing sql query output data to file
    By suhas.nehete in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-05-2008, 01:01 AM
  7. writing excel VBA Query for fetching data from Access
    By vikas.bhandari in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-16-2007, 05:47 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1