Results 1 to 3 of 3
  1. #1
    nrichel is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2013
    Posts
    1

    Populate field from one table into another based on query result

    Hello - thanks in advance for your assistance with my question! The data I'm using comes from several Excel files - I'm using Access to simplify the data. Just wanted to mention that upfront.

    I have four tables:
    FY11
    FY12
    FY13
    Available

    All four tables have the same primary key - SSN. I'd like to update the Available table by combining the data from the RR field for each record in the FY tables. Each FY table has the same RR column with different results based on each record. The same SSN may appear in all three tables (even with the same RR) that's ok, I want to be able to see that a record has been identified for each FY. Here's an example:

    FY11 Table
    SSN Name RR State
    111-11-1111 Doe Jane PXR MD
    999-11-1111 Smith Bob CXR PA

    FY12 Table
    SSN Name RR State
    111-11-1111 Doe Jane PXR MD
    222-11-1111 Pine Mike CXR DC


    FY13 Table
    SSN Name RR State
    333-11-1111 Cedar Larry PXR CA
    222-11-1111 Pine Mike CXR DC



    Available Table
    SSN Name FY11 RR FY12 RR FY13 RR
    111-11-1111 Doe Jane PXR PXR Null
    999-11-1111 Smith Bob CXR Null Null
    and so on...

    Is there a way to do this using a nested IIf statement perhaps? I'm lost as to how to get this all into one table.

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    The current "Available" table is a bad design. You have it laid out like a spreadsheet.
    Also, using "SSN" a PK is really bad for several reasons....

    Consider a table like
    Available
    -------------
    Available_PK (Autonumber)
    SSN (Text)
    FullName (Text) Note: this should really be two fields FName and LName
    RR (Text)
    ST(Text) ("State" is a reserved word )
    FY (Text)

    This is a more normalized table structure. Again, it would be better to split the name into two fields.

    Import FY11 data using an append query, then update the FY field to "FY11"
    Import FY12 data using an append query, then update the FY field to "FY12"
    Import FY13 data using an append query, then update the FY field to "FY13"

  3. #3
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    It sounds like these tables - for three different financial years, maybe? - really need to be imported and merged. ssanfu has the overall advice right on the money.

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

Similar Threads

  1. Populate Field when result is Null
    By BarneyH4 in forum Queries
    Replies: 3
    Last Post: 06-25-2013, 11:03 AM
  2. Change field color based on result
    By dniezby in forum Programming
    Replies: 1
    Last Post: 05-01-2013, 09:43 PM
  3. Replies: 12
    Last Post: 06-25-2012, 01:42 PM
  4. Replies: 3
    Last Post: 10-03-2011, 02:33 PM
  5. Query result based upon two field conditions
    By diane802 in forum Access
    Replies: 35
    Last Post: 01-08-2010, 06:31 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