Replace only part of a field in Access 2000

  • Thread starter Thread starter Kim Giraffa
  • Start date Start date
K

Kim Giraffa

I am trying to run an update query that replaces only part
of a field value and am having no luck. The original data
in the field is 020-0000 where the last four digits are
always 0000. For the criteria I have typed ???-0000 and
this is bringing up all the records I need to update. I
need to update these records to ???-0001. Where the first
three numbers remain the same. Any ideas???
 
Kim Giraffa said:
I am trying to run an update query that replaces only part
of a field value and am having no luck. The original data
in the field is 020-0000 where the last four digits are
always 0000. For the criteria I have typed ???-0000 and
this is bringing up all the records I need to update. I
need to update these records to ???-0001. Where the first
three numbers remain the same. Any ideas???

UPDATE YourTableName
SET YourFieldName = Left(YourFieldName, 7) & "1"
WHERE YourFieldName = "???-0000"
 
If you always have 3 digits + hyphen + 4 digits then you can construct a
Query with the SQL like:

UPDATE [YourTable]
SET [YourField] = Left([YourField], 7) & "0"
WHERE [YourField] Like "???-0000"
 
Back
Top