Results 1 to 4 of 4
  1. #1
    afinch03 is offline Novice
    Windows 10 Access 2007
    Join Date
    Jul 2016
    Posts
    2

    Populate column based on data in another column

    I am trying to find a way to populate a column based on the data in another column. I think it should be pretty easy, just don't know where to start.



    Here is essentially what I need:

    If column A = X, Y, or Z, populate (or update) column B with "M". If column A = U,V, or W, populate (or update) column B with "N."

    I assume I can do this with a query, but if there is some other functionality within Access that would be better, I would be willing to use that.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Since this is your first post ---welcome!

    Can you tell readers in a few lines WHAT you are trying to do? Plain English ---there may be some options.

    Most applications don't have columns A and B. We often see FirstName, ProductCode, SupplierNUmber etc.

  3. #3
    afinch03 is offline Novice
    Windows 10 Access 2007
    Join Date
    Jul 2016
    Posts
    2
    Current database has a column in the table called Product. Records are populated with product codes (e.g. "V", "S", "U"). I added a column in the table titled Magazine. I would like to populate this column with a value determined by the product code. (If Product = "V", "C", or "Y" populate Magazine with "Vac.")

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    If your table is called Product, then you should not have a field/column called Product. I think this maybe your Product code.
    It is best not to have spaces within and Access object names. So, assuming your Product table has fields/columns
    ProductCode and Magazine, then you could use a query

    Code:
    SELECT ProductCode, Magazine  from Product
    Where ProductCode In("V","C","Y")
    This will show which records would be updated.

    If this gives you the data you expect, then you could do an Update query
    Code:
    UPDATE Product
    SET Magazine = "Vac."
    Where  ProductCode In("V","C","Y")

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

Similar Threads

  1. Replies: 5
    Last Post: 02-23-2016, 10:03 AM
  2. Replies: 4
    Last Post: 12-29-2015, 03:25 PM
  3. Replies: 1
    Last Post: 10-24-2011, 04:11 PM
  4. Replies: 1
    Last Post: 03-14-2011, 10:04 AM
  5. Replies: 1
    Last Post: 04-15-2010, 02:07 AM

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