MY ERROR. I left out a closing parenthesis. Try one of these. You do
realize that the first will PERMANENTLY change the data in the field.
STEP 1: BACKUP your data before attempting the following.
STEP 2: BACKUP your data before attempting the following.
Without a backup you cannot restore the data if this does not work the way you
expect.
UPDATE tblItemDescription
SET ItemDescription = Left([ItemDescription],Len([ItemDescription])-13)
WHERE [ItemDescription] Like "*[0-9][0-9]/[0-9][0-9] -
[0-9][0-9]/[0-9][0-9]"));
This one is non-destructive:
SELECT IIF([ItemDescription] & "" Like "*[0-9][0-9]/[0-9][0-9] -
[0-9][0-9]/[0-9][0-9]",Left([ItemDescription],Len([ItemDescription])-13),[ItemDescription])
FROM tblItemDescription
John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
On your first example, I am not getting it to work. Have tried several
things but keep coming up with a Syntax error -- Missing Operator.
Second example, getting the same error.
I am sure it is something simple that I am just mentally missing.
John Spencer said:
Replace cannot use wild cards.
IF you want to do this permanently, you could use
UPDATE tblItemDescription
SET ItemDescription = Left([ItemDescription],Len([ItemDescription]-13)
WHERE [ItemDescription] Like "*[0-9][0-9]/[0-9][0-9] -
[0-9][0-9]/[0-9][0-9]"));
If you need to calculate the NewItemDescription then
SELECT IIF([ItemDescription] & "" Like "*[0-9][0-9]/[0-9][0-9] -
[0-9][0-9]/[0-9][0-9]",Left([ItemDescription],Len([ItemDescription]-13),[ItemDescription])
FROM tblItemDescription
John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
D wrote:
Thank you for your response. I have been playing with your suggestion but it
still needs some tweaking. Here is what I have:
SELECT Replace([ItemDescription],"*[0-9][0-9]/[0-9][0-9] -
[0-9][0-9]/[0-9][0-9] ","") AS NewDescription
FROM [tblItemDescription]
WHERE (((Replace([ItemDescription],"*[0-9][0-9]/[0-9][0-9] -
[0-9][0-9]/[0-9][0-9] ","")) Like "*[0-9][0-9]/[0-9][0-9] -
[0-9][0-9]/[0-9][0-9]"));
It is returning the data that matches but it is not replacing the date
characters. Any thoughts?
:
Hi,
You can accomplish it with wild cards:
where YourFieldName like "*[0-9][0-9]/[0-9][0-9]"
Clifford Bass
D wrote:
I have a text field that contains both numbers and text. At the end of some
of the data in this field , it has a partial date -- such as 12/24 - 01/23.
This date could be different for each record that contains it. I would
like this date portion stripped out completely as it is not needed and
interferes with queries when grouping. I have been unable to accomplish this
using wildcards. Is there another alternative?
--
Message posted via AccessMonster.com
.
.
.