Results 1 to 2 of 2
  1. #1
    ohthesilhouettes is offline Novice
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Posts
    7

    Querying Treaty Data

    HI I have a somewhat complex task for querying a table.

    I have the fields [TreatyName], [Country],[Year],[Action].

    -The TreatyName field contains the names of treaties [A,B,C].
    -The Country field contains the names of countries [USA,FRN,AUL]
    -The Year field contains the year the countries entered or withdrew from the treaty [1900,1980,1985,2000]. *The range of years is 1900-2010 but not all years are represented
    -The Action field contains the what the country did for the treaty at a particular year [Signature,Ratified,Withdrew]. *For a given treaty, a country can sign a treaty in one year, ratify the same treaty in same year or another year, and/or in another year, withdraw from the treaty.

    I want to treat the Signature and Ratification action of a treaty for a country as the same. A country can sign a treaty but never ratify the treaty but doing both does not matter to me. I am just interested in the first instance a country "enters" into the treaty(either Signing or ratifying or both). Similarly I want to know when a country withdraws from the treaty(if it ever does).

    If there there are two records of a country entering the treaty(Signed and Ratified) I want Access to return the the record with the earliest date the country entered into the treaty and count that. Signed or Ratified, whichever comes first, and if applicable, the date it withdrew from the treaty.

    For example, USA signed treaty "A", in 1980, then it ratified treaty "A" in 1985, then it withdrew from treaty "A" in 2000.

    Thus I should see a query table showing the record when USA signed treaty "A" in 1980 (because it was the earliest) and another record of when USA withdrew from treaty "A" in 2000.



    How do I get Access to look at the two records (from 1980 and 1985) and choose the earlier date? I assume I will be needing some fancy iif statements and some type of way for access to choose the earliest records. Any help would be appreciated!

  2. #2
    ketbdnetbp is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Midwest
    Posts
    254

    ohthesilhouettes -

    As a starting point, you may want to look into the DMin and DMax functions in VB/Access help.

    All the best,

    Jim

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

Similar Threads

  1. Querying from a Query
    By jo15765 in forum Queries
    Replies: 11
    Last Post: 11-21-2010, 08:12 PM
  2. Querying a Subform
    By jonillson in forum Forms
    Replies: 9
    Last Post: 11-19-2010, 12:04 PM
  3. Querying a password DB
    By blacksaibot in forum Programming
    Replies: 2
    Last Post: 05-20-2010, 10:37 AM
  4. Querying from 2 tables
    By egnaro in forum Queries
    Replies: 6
    Last Post: 01-28-2010, 06:30 PM
  5. Help Querying series
    By ktmchugh in forum Queries
    Replies: 20
    Last Post: 05-05-2009, 04:31 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