Results 1 to 4 of 4
  1. #1
    MazT is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Apr 2016
    Posts
    2

    Creating a new column using a combination of data from different columns in access (New to the forum

    Hi

    I have a table with multiple columns - however i need to cleanse the data. Two of the columns (A and B) have the similar data collected from different sources. We generally go with the data in Column B as it is most accurate. However, due to an error that's occured, some of the data in B comes up as 'unknown/x'. My task is to update B where the cells return 'unknown/x' with the data in column A.

    In my mind I am thinking the best way to achieve this is to create a third column C, where I retain data in B except where B is 'unknown/x' in which case C will retain data in A.

    Is that the best way round it?

    What is the best syntax to use? I am desperate for help.

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    There are two ways to go about this:

    1. Update the data in column B with an Update Query.
    You would first create a query that only returns column B, and put "unknown/x" in the Criteria of this field. This will then only return records that have this value in it.
    Then, change it to an Update Query, and on the "Update to:" line for this field, enter [ColumnA] (or whatever the name of your column A field is).
    Then run the query.
    Column B will not be updated. You can complete remove column A from the table, if your desire.

    2. Create a query that returns the value you want in a Calculated Field. This is desireable if you wish to keep both the original column A and column B values (for historical reasons or whatever). That calculated field would look something like:
    MyValue: IIF([ColumnB]="unknown/x",[ColumnA],[ColumnB])

  3. #3
    MazT is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Apr 2016
    Posts
    2
    Quote Originally Posted by JoeM View Post
    There are two ways to go about this:

    1. Update the data in column B with an Update Query.
    You would first create a query that only returns column B, and put "unknown/x" in the Criteria of this field. This will then only return records that have this value in it.
    Then, change it to an Update Query, and on the "Update to:" line for this field, enter [ColumnA] (or whatever the name of your column A field is).
    Then run the query.
    Column B will not be updated. You can complete remove column A from the table, if your desire.

    2. Create a query that returns the value you want in a Calculated Field. This is desireable if you wish to keep both the original column A and column B values (for historical reasons or whatever). That calculated field would look something like:
    MyValue: IIF([ColumnB]="unknown/x",[ColumnA],[ColumnB])

    Thank you - I used the second option as I wanted to maintain both original columns. It worked like a breeze!

  4. #4
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You are welcome.
    Glad it all worked out for you!

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

Similar Threads

  1. Replies: 1
    Last Post: 11-12-2013, 02:19 AM
  2. Converting dBase forum to Access forum
    By amerifax in forum Forms
    Replies: 5
    Last Post: 07-03-2012, 01:12 AM
  3. Replies: 5
    Last Post: 03-29-2012, 09:21 PM
  4. Linking columns in access to a particular column.
    By israellawndale in forum Access
    Replies: 4
    Last Post: 08-16-2011, 02:55 PM
  5. Replies: 0
    Last Post: 02-14-2007, 01:35 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