Douglas J. Steele said:
Oops. Just noticed there's a space missing between the name of the table
and
the SET keyword. It should be:
DoCmd.RunSQL "UPDATE Size_tbl " & _
"SET [Name1] = Left([Name_Size], InStr([Name_Size], '-') - 1), " & _
"[Size1] = Mid([Name_Size], InStr([Name_Size], '-') + 1) " & _
"WHERE InStr([Name_Size], "-") > 1"
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
DoCmd.RunSQL "UPDATE Size_tbl" & _
"Set [Name1] = Left([Name_Size], InStr([Name_Size], '-') - 1), " & _
"[Size1] = Mid([Name_Size], InStr([Name_Size], '-') + 1) " & _
"WHERE InStr([Name_Size], "-") > 1"
Hopefully that'll survive word-wrap...
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
here is my code and it does not work.
DoCmd.RunSQL "UPDATE Size_tbl"
Set [Name1] = Left([Name_Size], InStr([Name_Size], "-") - 1)
[Size1] = Mid([Name_Size], InStr([Name_Size], "-") + 1)
WHERE InStr([Name_Size], "-") > 1
do you know why?
the field are as Text in the table.
and I named as Size1 and Name1
Thanks
ld
--
Lorenzo DÃaz
Cad Technician
:
UPDATE MyTable
SET [Name] = Left([Name_Size], InStr([Name_Size],"-") - 1),
[Size] = Mid([Name_Size], InStr([Name_Size], "-") + 1)
WHERE InStr([Name_Size], "-") > 0
Note that Name and Size are not good names for fields in tables: I
believe
they're both reserve words.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Hi Douglas,
thank for your answer ,I have a problem writting the Update
statement,
could
you help me please.
--
Lorenzo DÃaz
Cad Technician
:
What's in front of the dash will be Left([Name_Size],
InStr([Name_Size],
"-") - 1).
What's after the dash will be Mid([Name_Size], InStr([Name_Size],
"-") +
1).
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Hi, I have a Table with information like this,
Name_Size
FELSEN 1272-LL/LX-1L
FRACA 2031-LR/LSX+2
GALLADORA 2288-LR/LSX+2
but now I want to separare it in two column
Name Size
FELSEN 1272- LL/LX-1L
FRACA 2031- LR/LSX+2
GALLADORA 2288- LR/LSX+2
I want it sperated after of the dash.
I know that I need to run an SQL update but I don't how
separate
it.
could you help me on this please.