Results 1 to 2 of 2
  1. #1
    cgolds is offline Novice
    Windows XP Access 2000
    Join Date
    Jun 2007
    Posts
    3

    Amending a Field


    I need help figuring out how to add a prefix to an existing description in a project table, generated from the project number.
    Here's a sample of my data:

    PROJECT NUMBER DESCRIPTION
    01200000 Completed Projects
    01601530 Steele Sub

    I would like the Descriptions to read:
    01200000 MO-20 Completed Projects
    01601530 MO-60 Steele Sub

    The state, “MO,” comes from the first two digits “01” and the coop, “60,” comes from the second two digits. I have a table of a thousand or so projects in an Access database that I need to amend the descriptions of to include these prefixes. Is there a simple way to do this in Access or in Excel without writing code?

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    Build another table with a list of the State ID (first two numbers) and second field with State Name. In your query, create a new field "StateID:Left(Project,2)". This will give you the state code. Save this query. Create a new query and make the first query the source. Join the new table to the old query on the StateID. Create a new field "ProjectID: [NewTable.State Name] &"-"& Mid([Project],3,2)". Run the query. It should give you the new Project ID.

    Alan

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

Similar Threads

  1. Replies: 8
    Last Post: 04-13-2012, 12:25 PM
  2. Replies: 16
    Last Post: 04-11-2012, 10:56 AM
  3. Replies: 1
    Last Post: 03-03-2012, 10:17 PM
  4. Replies: 1
    Last Post: 02-20-2012, 01:59 PM
  5. Replies: 9
    Last Post: 12-15-2010, 01:44 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