Results 1 to 2 of 2
  1. #1
    brianb is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2011
    Posts
    8

    Query to Add field to Identify list of items

    I'm not sure exaclty how to explain what I'm wanting but here goes;



    I have a query that is pulling about a couple thousand rows of data w/about 25 columns. One of the cols has an ID tag. The id is a abbreviated name. There are about 30 different IDs. These IDs can be grouped in to 4 differnet main groups. So for example IDs ABC, MNO, QR would be group 1, IDs XYZ, HIJ, can be group two.

    What I want to do is add a field into my select query and label it something like Grouping, and if id is ABC, MNO, QR, then the field would show Group1, if ID is XYZ, HIJ, field woudl show Group2, now I know i can do this with an IIF statment, but w/about 30 different IDs that would make it pretty long. Any way to do this in a shorter simpler way? I have som basic vba knowledge, but nothing to code this. Thanks

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The normalized approach would likely be a table with the two fields:

    ABC...1
    MNO...1
    XYZ...2

    That is more maintainable than an IIf(), and in your query you would simply join in this new table.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 4
    Last Post: 04-05-2011, 06:12 PM
  2. Edit List Items
    By Broderhol in forum Forms
    Replies: 3
    Last Post: 02-23-2011, 05:51 PM
  3. Highlighting Items in List Box from Table Data
    By swalsh84 in forum Programming
    Replies: 2
    Last Post: 01-25-2010, 08:55 AM
  4. list box items
    By thewabit in forum Forms
    Replies: 12
    Last Post: 01-01-2010, 08:59 PM
  5. Replies: 1
    Last Post: 11-11-2006, 08:23 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