Moving the end of one field to another

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Phil

    Moving the end of one field to another

    Hello,

    I have a table with 2 columns called catcode and prodcode and an example
    would be like this:

    catcode | prodcode

    home-frag-cd | H-ACP1003
    lighting-cd | H-AR1009
    bed-candles-ys | H-BSC1005


    What I need to do is take whatever comes after the last "-" in catcode and
    add it and the "-" to the end of prodcode. So the result on the above
    would be:

    catcode | prodcode

    home-frag-cd | H-ACP1003-cd
    lighting-cd | H-AR1009-cd
    bed-candles-ys | H-BSC1005-ys

    If it helps, the last 3 characters of catcode are always the "-" plus the
    suffix that needs to be moved.

    How can I do this?

    Thank you.
  • Fredg

    #2
    Re: Moving the end of one field to another

    Phil,
    I'll take you at your word that the last 3 characters are always -XX.

    You can make an update query to permanently add the last 3 characters of one
    field to the other field.

    Update YourTable Set YourTable.ProdC ode = ProdCode & Right([CatCode],3);

    --
    Fred

    Please reply only to this newsgroup.
    I do not reply to personal e-mail.


    "Phil" <phil@hoobermed ia.com> wrote in message
    news:0GQub.1901 52$9E1.1011826@ attbi_s52...[color=blue]
    > Hello,
    >
    > I have a table with 2 columns called catcode and prodcode and an example
    > would be like this:
    >
    > catcode | prodcode
    >
    > home-frag-cd | H-ACP1003
    > lighting-cd | H-AR1009
    > bed-candles-ys | H-BSC1005
    >
    >
    > What I need to do is take whatever comes after the last "-" in catcode and
    > add it and the "-" to the end of prodcode. So the result on the above
    > would be:
    >
    > catcode | prodcode
    >
    > home-frag-cd | H-ACP1003-cd
    > lighting-cd | H-AR1009-cd
    > bed-candles-ys | H-BSC1005-ys
    >
    > If it helps, the last 3 characters of catcode are always the "-" plus the
    > suffix that needs to be moved.
    >
    > How can I do this?
    >
    > Thank you.[/color]


    Comment

    Working...