Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Some sort of "Find and replace"

Discussion in 'Information Technology' started by Adidre1, Jul 28, 2006.

  1. Adidre1

    Adidre1
    Expand Collapse
    Guest

    Hello,

    I need to update a text field in a table which contains strings of variable
    lenght separated by % character: AAAAA%BBBBB%CCCC.
    How can I create a query or a function to keep in that field just the BBBBB
    string?
    In Excel I used find and replace:
    - find A*% and replace with NULL
    - find %C* and replace with NULL and I have just BBBBB string
    How can I do the same thing in Access?

    THX
     
  2. Loading...

    Similar Threads Forum Date
    I am sort of new to Sikhism New to Sikhism May 3, 2013
    Consortium agrees to pay 11.3 billion dollars for SunGard Data Systems (AFP) Interfaith Dialogues Mar 28, 2005
    Pathfinder Joins Sikh Philosophy Network! New SPN'ers Sep 5, 2016
    The Salmon Story, Finding Home Sikh Sikhi Sikhism Jul 29, 2016
    Sikhi Guru Nanak's Methodology Of Finding Truth Sikh Sikhi Sikhism Jan 1, 2016

  3. Jon Lewis

    Jon Lewis
    Expand Collapse
    Guest

    Have a look at the InStr, Left, Mid, Right functions.


    "Adidre1" <Adidre1@discussions.microsoft.com> wrote in message
    news:CE4E196F-4D59-45AB-9A75-2E9B69FDBCEA@microsoft.com...
    > Hello,
    >
    > I need to update a text field in a table which contains strings of
    > variable
    > lenght separated by % character: AAAAA%BBBBB%CCCC.
    > How can I create a query or a function to keep in that field just the
    > BBBBB
    > string?
    > In Excel I used find and replace:
    > - find A*% and replace with NULL
    > - find %C* and replace with NULL and I have just BBBBB string
    > How can I do the same thing in Access?
    >
    > THX
     
  4. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    Is it always going to be 3 strings separated by % and you always want the
    2nd string?

    You can use the Split function:

    Split(MyString, "%")(1)

    will give you the 2nd string (it starts counting at 0)

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Adidre1" <Adidre1@discussions.microsoft.com> wrote in message
    news:CE4E196F-4D59-45AB-9A75-2E9B69FDBCEA@microsoft.com...
    > Hello,
    >
    > I need to update a text field in a table which contains strings of

    variable
    > lenght separated by % character: AAAAA%BBBBB%CCCC.
    > How can I create a query or a function to keep in that field just the

    BBBBB
    > string?
    > In Excel I used find and replace:
    > - find A*% and replace with NULL
    > - find %C* and replace with NULL and I have just BBBBB string
    > How can I do the same thing in Access?
    >
    > THX
     
  5. Adidre1

    Adidre1
    Expand Collapse
    Guest

    Sometimes the first and the last string are missing...
    And I have to work with Access 97

    Thanks

    "Douglas J Steele" wrote:

    > Is it always going to be 3 strings separated by % and you always want the
    > 2nd string?
    >
    > You can use the Split function:
    >
    > Split(MyString, "%")(1)
    >
    > will give you the 2nd string (it starts counting at 0)
    >
    > --
    > Doug Steele, Microsoft Access MVP
    > http://I.Am/DougSteele
    > (no e-mails, please!)
    >
    >
    > "Adidre1" <Adidre1@discussions.microsoft.com> wrote in message
    > news:CE4E196F-4D59-45AB-9A75-2E9B69FDBCEA@microsoft.com...
    > > Hello,
    > >
    > > I need to update a text field in a table which contains strings of

    > variable
    > > lenght separated by % character: AAAAA%BBBBB%CCCC.
    > > How can I create a query or a function to keep in that field just the

    > BBBBB
    > > string?
    > > In Excel I used find and replace:
    > > - find A*% and replace with NULL
    > > - find %C* and replace with NULL and I have just BBBBB string
    > > How can I do the same thing in Access?
    > >
    > > THX

    >
    >
    >
     
  6. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    Well, it's possible to write a Split function for Access 97, but if you
    don't know the number of substrings in advance, you're probably better off
    using the InStr and Mid like Jon suggested.

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Adidre1" <Adidre1@discussions.microsoft.com> wrote in message
    news:3BAC1917-4C10-4A61-B99E-8F75171A6D6B@microsoft.com...
    > Sometimes the first and the last string are missing...
    > And I have to work with Access 97
    >
    > Thanks
    >
    > "Douglas J Steele" wrote:
    >
    > > Is it always going to be 3 strings separated by % and you always want

    the
    > > 2nd string?
    > >
    > > You can use the Split function:
    > >
    > > Split(MyString, "%")(1)
    > >
    > > will give you the 2nd string (it starts counting at 0)
    > >
    > > --
    > > Doug Steele, Microsoft Access MVP
    > > http://I.Am/DougSteele
    > > (no e-mails, please!)
    > >
    > >
    > > "Adidre1" <Adidre1@discussions.microsoft.com> wrote in message
    > > news:CE4E196F-4D59-45AB-9A75-2E9B69FDBCEA@microsoft.com...
    > > > Hello,
    > > >
    > > > I need to update a text field in a table which contains strings of

    > > variable
    > > > lenght separated by % character: AAAAA%BBBBB%CCCC.
    > > > How can I create a query or a function to keep in that field just the

    > > BBBBB
    > > > string?
    > > > In Excel I used find and replace:
    > > > - find A*% and replace with NULL
    > > > - find %C* and replace with NULL and I have just BBBBB string
    > > > How can I do the same thing in Access?
    > > >
    > > > THX

    > >
    > >
    > >
     

Share This Page