Rearranging Data in an MS Access 2007 table into a new column

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Moses Wati
    New Member
    • Apr 2015
    • 3

    #1

    Rearranging Data in an MS Access 2007 table into a new column

    Hi,

    I have Access tables with fields that have the following format:

    Code:
    --------------------------------------
    |CONSIGNEE_NAMES| CONFIRMATION |CONSIGNOR_NAMES|
    --------------------------------------
    |WATI SMITH    |              | NAUMI WILLIS  |     
    |ALAIN PHELLY  |              | BAHATI BOB    |
    |MOSES NJESH   |              | LIL TONY      |
    |NAUMI WILLIS  |              | WATI SMITH    |
    |Max BROWN     |              | MIKE NJAGA    |
    |LIL TONY      |              | WAWERU PETER  |
    |VICTOR SEKE   |              | VICTOR SEKE   |   
    |UHURU KAZI    |              | JANET WECHE   |  
    |GEORGE KARI   |              |               |
    |KATE FIONA    |              |               |
    |MILLIY WENDY  |              |               |
    -----------------------------------

    I need field CONFIRMATION to pic any name from field CONSIGNEE_NAMES that matches the names in field CONSIGNOR_NAMES as shown below..

    Code:
    ----------------------------------------------
    |CONSIGNEE_NAMES| CONFIRMATION |CONSIGNOR_NAMES|
    -----------------------------------------------
    |WATI SMITH    |NAUMI WILLIS  | NAUMI WILLIS  |     
    |ALAIN PHELLY  |              | BAHATI BOB    |
    |MOSES NJESH   |LIL TONY      | LIL TONY      |
    |NAUMI WILLIS  |WATI SMITH    | WATI SMITH    |
    |Max BROWN     |              | MIKE NJAGA    |
    |LIL TONY      |MOSES NJESH   | MOSES NJESH   |
    |VICTOR SEKE   |VICTOR SEKE   | VICTOR SEKE   |   
    |UHURU KAZI    |              | JANET WECHE   |
    |GEORGE KARI   |              |               |
    |KATE FIONA    |              |               |
    |MILLIY WENDY  |              |               |
    Kindly help..
    Last edited by Rabbit; Apr 29 '15, 04:30 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • twinnyfo
    Recognized Expert Moderator Specialist
    • Nov 2011
    • 3665

    #2
    Moses,

    I do not understand what you are trying to do. Based on your example, only some of the names in the field CONSIGNOR_NAMES were added to the field CONFIRMATION. What is the determining criteria for copying the name?

    Comment

    • Moses Wati
      New Member
      • Apr 2015
      • 3

      #3
      twinnyfo,

      well twinnyfo,that is exactly what I need, I need field CONFIRMATION to receive the names that match field CONSIGNOR_NAMES ...those names will be pasted in that field (CONFIRMATION)a nd the names that don't match field CONSIGNOR_NAMES to be deleted.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Outer join the table to itself on consignee to consignee and consignor to consignee

        Comment

        • Moses Wati
          New Member
          • Apr 2015
          • 3

          #5
          Yes that's what I need to do @Rabbit

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32669

            #6
            So, in a nutshell, you want the [Confirmation] field to be updated to reflect the [Consignor_Names] field for each record where the [Consignor_Names] value matches matches any one of the values in [Consignee_Names]? Actually, even though you don't say so, it looks like your example data is matching those records (Either single records or pairs.) where Consignor matches Consignee as well as Consignee matching Consignor.

            I suspect Rabbit's suggestion was intended to reflect that but appears to have a typo.
            Originally posted by Rabbit
            Rabbit:
            Outer join the table to itself on consignee to consignor and consignor to consignee
            I've underlined where I think that was.

            I believe, if the requirement is actually as specific as I suspect it is, then you'll need just the link between Consignee and Consignor (OUTER JOIN). You would then filter on (and update only if) the Consignee of the JOINed version of the table matches Consignor of the main one.

            The next step is for you to go away and apply that advice in your project and let us know how you get on. No-one here will simply do it for you.
            Last edited by NeoPa; May 6 '15, 01:44 AM.

            Comment

            Working...