Results 1 to 3 of 3
  1. #1
    Bdowns is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2012
    Posts
    28

    Update query to find and replace with wildcards

    CAT01 to CA01
    CAT02 to CA02


    CAT03 to CA03
    CAT04 to CA04
    CAT05 to CA05
    ...

    How can I make all these updates in one shot? Thanks!

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Let's assume CAT01---CAT05 are values of field ZZZCode

    (untested but I think it should work)

    Update yourTableName
    Set ZZZcode = Replace(ZZZcode,"T","")
    WHERE ZZZCode in ("CAT01","CAT02","CAT03","CAT04","CAT05")

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Not sure what you are asking. I seems you know to use an update query.
    What have you tried?

    If you do not want to edit the query, you could use VBA to execute the queries.

    It just occurred to me (since you used "..."), there might be more than 5 changes.

    If so, the VBA method might be better.
    Create a table with two fields: "ChangeFrom" and "ChangeTo"
    Using VBA, open a recordset, looping through it getting the from an to names. Execute the query.


    Edit: Try Orange's solution first..... I keep forgetting about the replace function.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 03-16-2013, 11:10 AM
  2. Update with replace query help
    By goomba79 in forum Queries
    Replies: 4
    Last Post: 12-14-2012, 08:27 AM
  3. Find and Replace
    By Bedsingar in forum Access
    Replies: 1
    Last Post: 08-14-2011, 01:10 PM
  4. Find and Replace query from a 2nd table
    By elightbox in forum Queries
    Replies: 1
    Last Post: 09-17-2010, 05:37 PM
  5. Find and Replace Query
    By randolphoralph in forum Queries
    Replies: 4
    Last Post: 03-17-2010, 07:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums