mitzilla
asked on
How do I batch cut and paste across columns in Access 2007
I have a Access Database that has a name field with both last, first and middle names (ex: Smith, John H.) in the same field. I want to separate them into individual columns and fields. There are 12,000 names.
How can I do this?
How can I do this?
I don't know that there's an easy way just within Access to do it, but it could be done with a vb-script. if you've already got a connection to the database w/ your ASP page and the added columns exist...
pull recordset
FOR each record
set recordID < key variable from record
set namevariable < from original field
separateName = split(namevariable, " ")
sql update recordID lastname = separateName(0) firstname = separateName(1) initial = separateName(2)
could do some additional fiddling with the text to peel off the commas and periods as well. save that asp page (i'm assuming from the zones listed you're working within a web application) and run it once to see what you get. obviously run against a backup copy of your database first.
pull recordset
FOR each record
set recordID < key variable from record
set namevariable < from original field
separateName = split(namevariable, " ")
sql update recordID lastname = separateName(0) firstname = separateName(1) initial = separateName(2)
could do some additional fiddling with the text to peel off the commas and periods as well. save that asp page (i'm assuming from the zones listed you're working within a web application) and run it once to see what you get. obviously run against a backup copy of your database first.
You could export the table into excel and then open the excel file, then in three columns create formulas.
I have attached a sample spreadsheet with the formulas.
This will work so long as the full name column has the data in the format:
Surname, Forname Initial
sample.xls
I have attached a sample spreadsheet with the formulas.
This will work so long as the full name column has the data in the format:
Surname, Forname Initial
sample.xls
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
That article includes a sample MDB file.
Also keep in mind that multi-word name parts are always, always going to give you fits :)
ASKER
Thanks everyone!
mitzilla,
you did not even try the first post ???
you did not even try the first post ???
ASKER
Capricorn1,
Actually I tried all of the posts. But my understanding of access is still really really at a beginner status.
I couldn't get the module to be seen by the query. I had to poke around for like fifteen minutes before I even found that feature. Apologies, I'm sure yours would of worked perfectly and I did give it a shot. I just couldn't get my head around it.
Thanks
Actually I tried all of the posts. But my understanding of access is still really really at a beginner status.
I couldn't get the module to be seen by the query. I had to poke around for like fifteen minutes before I even found that feature. Apologies, I'm sure yours would of worked perfectly and I did give it a shot. I just couldn't get my head around it.
Thanks
<I couldn't get the module to be seen by the query. >
you could have posted a question, so the other will know if you are having difficulty with the posted suggestion and can post information to help you with the problem.
you could have posted a question, so the other will know if you are having difficulty with the posted suggestion and can post information to help you with the problem.
then write a query like this
select [name], splitname(1,[name]) as firstName,splitname(2,[nam
from tableX
Open in new window