Re: Update query

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: John Spencer (MVP) (spencer4_at_comcast.net)
Date: 01/02/05


Date: Sun, 02 Jan 2005 09:07:26 -0500

Several methods. But probably the best is to build a table of equivalents and
then use that in your update query.

tblEquivalents
--fldCurrent (Jon, Ed, Dave, ...)
--fldNewValue(Jonathan, Edward, David, ...)

Now, you can use that to update your existing table by joining the Existing
table to the table of equivalents based on a join between the First_Name and
fldCurrent. The new value would be fldNewValue. The SQL would look something
like (UNTESTED SQL):

UPDATE ExistingTable As E INNER JOIN tblEquivalents as N
  ON E.First_Name = N.fldCurrent
SET E.First_Name = N.fldNewValue

Other methods would use the Switch Function or nested iff statements and are not
nearly as flexible.

Steve wrote:
>
> How do I go about developing an update query to update the same column
> in a table based on several criteria?
>
> For example, in the first_name column I'd like to update Jon to
> Jonathan, Ed to Edward, Dave to David, Frank to Franklin, etc.
>
> Can a single update query do this? Using Access 2002.
>
> Thanks.
>
> Steve



Relevant Pages

  • Re: Export to a text file question
    ... it's pretty easy to slap together an UPDATE query that ... >carriage returns. ... >> Dave wrote: ...
    (microsoft.public.access.queries)
  • Re: Re:I Meant Append Query - Sorry
    ... To the PM field append ... I want to run an update query dumping certain fields (Including the ... So I am guessing I need to put some kind of if statement in the criteria ...
    (microsoft.public.access.queries)
  • Re:I Meant Append Query - Sorry
    ... "Dave" wrote in message ... I want to run an update query dumping certain fields into another table. ... The receiving table has AM and PM Yes No Boxes ... Or something like that - but I can't seem to get the syntax of a correct criteria. ...
    (microsoft.public.access.queries)
  • Update query Criteria help needed
    ... I want to run an update query dumping certain fields into another table. ... Or something like that - but I can't seem to get the syntax of a correct criteria. ...
    (microsoft.public.access.queries)
  • using an IIF with a field value to update
    ... Hello all, I am running, or at least trying to run an update query using an ... iif statements. ... I have a field called LicType, which can either be "2 Year" ... Jon M. ...
    (microsoft.public.access.queries)