Update Query Problem

  • Thread starter Thread starter Bob Vance
  • Start date Start date
B

Bob Vance

When I run my update query , the query says it will change 42 rows, but no
data is changed!
UPDATE tblOwnerInfo SET OwnerLastName =
Switch([OwnerLastName]="L","K",True,[OwnerLastName]);
 
Do you have a record where the OwnerLastName is "L"? Your update query
is going to update every record in the table tblOwnerInfo.

Perhaps what you want to do is

UPDATE tblOwnerInfo
SET OwnerLastName = "K"
WHERE OwnerLastName = "L"

You must execute (run) the query for it too actually update anything.
Simply switching to DataSheet view will not run the query. Switching to
datasheet view will show you the current values that would be changed if
you run the query.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
Then you might want

UPDATE tblOwnerInfo
SET OwnerLastName = REPLACE([OwnerLastName],"L","K")
WHERE OwnerLastName LIKE "*L*"

This will change all the L letters to K in records where there is at least on
L in the OwnerLastName.

I would be very sure that I backed up the table before i did this.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

Bob said:
Im wanting to change L in a word for K so "walk" become "wakk"
Thanks Bob
Bob Vance said:
When I run my update query , the query says it will change 42 rows, but no
data is changed!
UPDATE tblOwnerInfo SET OwnerLastName =
Switch([OwnerLastName]="L","K",True,[OwnerLastName]);
 
Back
Top