Results 1 to 4 of 4
  1. #1
    Machwon is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Sep 2014
    Posts
    2

    Help an Access NOOB with an interesting query?

    Hey folks- I'm new around here, and relatively new to Access in general. I work for a Colorado Assessor's Office and am becoming their query guy and need some help I'm running Windows 7 with Access 2003. We do our querying via Access on our County Assessment database. Without getting too into the boring details here's the situation.

    We are needed to find Natural Resource Accounts (ACCOUNTNO = "N*") that were active (STATUS = "A") in 2013 (TAXYEAR = 2013), and then deactivated (STATUS = "D") in 2014 (TAXYEAR = 2014). Those are the only accounts we need- however with my basic skills I am only able to get to the point of having all Natural Resource accounts that were both active and deactivated in both 2013 and 2014. I have attached some screenshots of what we are looking at. Can anyone think of a basic expression or If Then statement that I could use to get only the accounts that were Active in 2013, and deactivated in 2014? Thanks in advance folks!!

    Click image for larger version. 

Name:	N_Query.jpg 
Views:	15 
Size:	196.9 KB 
ID:	18260

    The table that is resulting with about 9,000 records- we are looking for less than 100 meeting our criteria.



    Click image for larger version. 

Name:	N_Query_Table.jpg 
Views:	15 
Size:	129.0 KB 
ID:	18262

    Thanks everyone!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    1. you can make 2 queries and put them together in a UNION query (3rd qry). This helps you KNOW what you are querying definitively.
    Q1 = (STATUS = "A") in 2013 (TAXYEAR = 2013)
    Q2 = (STATUS = "D") in 2014 (TAXYEAR = 2014)
    Q3 = select * from Q1 UNION select * from Q2

    OR

    in 1 query
    you must make a separate criteria line for EACH different option
    1st line like you have but only status A, in 2013
    2nd line SAME criteria like <= verstart, etc,.. EXCEPT use : status D in 2014

  3. #3
    Machwon is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Sep 2014
    Posts
    2
    Ranman- thank you so much for the quick response. As I have never tried a union query- I attempted the 2nd option (just adding a separate criteria line). It did narrow down the results, however the table is now displaying ALL active 2013s, and all active 2014s... is there an easy way to keep the duplicates to narrow it down?

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    Did you try setting the query property: UNIQUE VALUES = YES.
    I havent tried with multiple criteria lines, but should work to remove dupes. (tho if you include year, youd get dupes w different years)

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

Similar Threads

  1. Interesting Query, Need help!!
    By accessdba in forum Queries
    Replies: 1
    Last Post: 10-06-2011, 11:54 AM
  2. Interesting multi query problem.
    By daltman1967 in forum Queries
    Replies: 1
    Last Post: 07-28-2011, 02:52 PM
  3. Help! Very interesting query problem
    By pinecrest515 in forum Queries
    Replies: 5
    Last Post: 12-15-2010, 11:46 AM
  4. Help with Query!!! (Interesting Problem)
    By pinecrest515 in forum Queries
    Replies: 4
    Last Post: 12-09-2010, 08:20 AM
  5. Interesting Query Problem
    By Lockrin in forum Queries
    Replies: 7
    Last Post: 08-23-2010, 01:56 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