query to extract the portion of text of fields in a Table

F

Fuzuy

All: I have a table have several fields that I would like to modify
from its original text content to only retain its first 25 characters.
How to do it in a query such that it could overwrite the fields of
that table? Thanks.
 
J

John Spencer

USE an update query and the Left function.

UPDATE YourTable
SET FieldA = LEFT([FieldA],25)
, FieldB = Left([FieldB],25)

This is a PERMANENT change.

In the query grid
-- Select the fields you want to modify
-- Select Query: Update from the menu
-- in UPDATE TO under each field you want to change type Left([Name of
field],25)
-- Select Query: Run from the menu.

WARNING: Back up your table data FIRST. Make a copy of the table or backup
the entire database. There is no undo.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
J

Jerry Whittle

UPDATE YourTable SET YourTable.[TheField] = Left([TheField],25);

Repeat for each field.
 
Top