Find/Replace with code

C

Charlie

I want my code to do what I manually do, but don't know how. I open up the
table [Names] and run a find/replace; I find this: ^b
and replace it with nothing. I search all the table, and any part of the
fields. How do I do this programatically?
thanks,
ck
 
P

pietlinden

I want my code to do what I manually do, but don't know how. I open up the
table [Names] and run a find/replace; I find this: ^b
and replace it with nothing. I search all the table, and any part of the
fields. How do I do this programatically?
thanks,
ck

run an update query. or are you replacing formatting?
 
C

Charlie

Okay, I got an update query to work for replacing ^B.
However, I also need to replace (with nothing) the following:
the bracket sign < and then any text that would be here and then the
bracket >
So in other words, I want to find and delete all instances of the brackets <
with what ever text is between them.
I don't think you can put all that in a query, can you?
thanks,
ck


I want my code to do what I manually do, but don't know how. I open up the
table [Names] and run a find/replace; I find this: ^b
and replace it with nothing. I search all the table, and any part of the
fields. How do I do this programatically?
thanks,
ck

run an update query. or are you replacing formatting?
 
J

John Spencer

If there is only one set of brackets then you could use the following.

UPDATE YourTable
SET YourField = Left(YourField,Instr(1,YourField,"<")-1) &
Mid(YourField,Instr(1,YourField,">")+1)
WHERE YourField Like "*<*>*"

That would error if you had a field that Started with "<". You could change
the criteria to
WHERE YOURField Like "?*<*>*"
Or you could edit the expression to check the first character and if it was
"<" then don't subtract 1 to get the starting point.
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Charlie said:
Okay, I got an update query to work for replacing ^B.
However, I also need to replace (with nothing) the following:
the bracket sign < and then any text that would be here and then the
bracket >
So in other words, I want to find and delete all instances of the brackets
<
with what ever text is between them.
I don't think you can put all that in a query, can you?
thanks,
ck


I want my code to do what I manually do, but don't know how. I open up
the
table [Names] and run a find/replace; I find this: ^b
and replace it with nothing. I search all the table, and any part of
the
fields. How do I do this programatically?
thanks,
ck

run an update query. or are you replacing formatting?
 
Top