Welcome to SPN

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

Sign Up Now!

Question about using Update query replace function together-Fails in Access 2002

Discussion in 'Information Technology' started by Mike Strout, Nov 2, 2005.

  1. Mike Strout

    Mike Strout
    Expand Collapse
    Guest

    I have a fairly large Sql2k DB in which I am trying to update some addresses
    so the Post Office will deliver our statements. Here is the query I am
    trying to run...

    UPDATE dbo_PATIENT SET dbo_PATIENT.ADDRESS =
    Replace([dbo_PATIENT.ADDRESS],[Enter old string],[Enter new string])
    WHERE (((dbo_PATIENT.ADDRESS) Like "* " & [Enter old string] & " *"));

    What I am trying to accomplish is to replace all instances of a given
    substring in the address field based on the two parameters entered by the
    user. For example, the field may contain...

    1234 CR 47

    I want to query the table and replace all instances of "CR" with "Country
    Road". You may notice that I left spaces between the wildcards and the
    parameters. This is so "987 Creekside Trail" doesn't get changed to "987
    County Roadeekside Trail".

    Hopefully this all makes sense. Now the problem. When I click on the
    Datasheet view in access, I will get a correct match on 1234 CR 47 and it
    will be displayed. However, when I actually try to execute the query, I get
    0 matching rows, even though I enter the parameters exactly the same.

    What is going on?

    Mike
    <><
     
  2. Loading...

    Similar Threads Forum Date
    Question About GGS Questions and Answers Aug 28, 2016
    Marriage And Discrimination Related Questions Blogs Mar 21, 2016
    Sikhi Questioning Faith Sikh Sikhi Sikhism Mar 3, 2016
    Entering into Sikhism: Questions on Reht Maryada. Blogs Oct 22, 2015
    A question about kes/hair? Blogs Oct 21, 2015

  3. Dirk Goldgar

    Dirk Goldgar
    Expand Collapse
    Guest

    "Mike Strout" <m i k e s t r o u t @ h o t m a i l . c o m> wrote in
    message news:ePP9f.2496$IB.2356@dukeread11
    > I have a fairly large Sql2k DB in which I am trying to update some
    > addresses so the Post Office will deliver our statements. Here is the
    > query I am trying to run...
    >
    > UPDATE dbo_PATIENT SET dbo_PATIENT.ADDRESS =
    > Replace([dbo_PATIENT.ADDRESS],[Enter old string],[Enter new string])
    > WHERE (((dbo_PATIENT.ADDRESS) Like "* " & [Enter old string] & " *"));
    >
    > What I am trying to accomplish is to replace all instances of a given
    > substring in the address field based on the two parameters entered by
    > the user. For example, the field may contain...
    >
    > 1234 CR 47
    >
    > I want to query the table and replace all instances of "CR" with
    > "Country Road". You may notice that I left spaces between the
    > wildcards and the parameters. This is so "987 Creekside Trail"
    > doesn't get changed to "987 County Roadeekside Trail".
    >
    > Hopefully this all makes sense. Now the problem. When I click on the
    > Datasheet view in access, I will get a correct match on 1234 CR 47
    > and it will be displayed. However, when I actually try to execute the
    > query, I get 0 matching rows, even though I enter the parameters
    > exactly the same.
    >
    > What is going on?
    >
    > Mike
    > <><


    How are you executing the query? Directly from the query design view,
    or using code (and if code, what code)? Is this in an MDB file with
    linked tables (sounds like it), or in ADP?

    --
    Dirk Goldgar, MS Access MVP
    www.datagnostics.com

    (please reply to the newsgroup)
     

Share This Page