My Assistant
![]() ![]() |
|
|
Apr 17 2012, 08:58 AM
Post
#1
|
|
|
New Member Posts: 10 |
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? |
|
|
|
Apr 17 2012, 09:04 AM
Post
#2
|
|
|
UtterAccess VIP Posts: 7,438 From: Oadby Leics, UK |
I can see the -60 and -20 but why does 01=MO ? Are there other values in use? Is there a lookup table ?
|
|
|
|
Apr 17 2012, 10:02 AM
Post
#3
|
|
|
New Member Posts: 10 |
That is just the system the database administrator set up. These are the only states we're involved in:
01 = MO 02 = KS 03 = AR 04 = OK 05 = IL 07 = TX We do not have a lookup table. The descriptions and project numbers were entered into a table simply as text or numbers. We are getting ready to migrate to new software and are trying to get our descriptions cleaned up before they bring them into the new application. |
|
|
|
Apr 17 2012, 10:21 AM
Post
#4
|
|
|
UtterAccess VIP Posts: 7,438 From: Oadby Leics, UK |
Well a lookup table would be better but if this is just a once-off exercise then you could run a parameter query several times - once for each state and do all the changes that way.
Update ProjectTableName set [description] = [Enter state letters] & "-" & Mid([project number] ,3,2) & " " & [Description] where left([project number] ,2) = [enter state numbers] So run this the first time entereing MO and 01 then run it again using KS and 02 and so on. Make sure you have a good backup before testing and executing. |
|
|
|
Apr 17 2012, 01:46 PM
Post
#5
|
|
|
New Member Posts: 10 |
Yes, this will be a one-time thing. I will try that. Thank you!
|
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 18th June 2013 - 06:33 PM |