Serch and replace help PLS ;0

R

Robert Brown

Ok,

I am working in Access 2003 with a MDB which has a table with around
26000 entries. One field contains some rtf data that I need to modify.

Basically I need to "search and replace", but when I try this I get an
error that tells me there is not enough free memory to continue search
operation. The PC is running XP and has 512 Megs of RAM and I have EVERY
program closed except Access.

I have tried using/learning to do this via a query, but I can't seem to
get anywhere.

Can someone help me to replace THIS:

YYYYYYY\rtf1\ansi\deff0{\fonttbl{\f0\froman\fprq2 Times New Roman;}{\f1
\fnil Georgia;}}
{\colortbl ;\red0\green0\blue0;}
{\*\generator Riched20 5.40.11.2210;}\viewkind4\uc1\pard\li2320\cf1
\lang1033\b\f0\GGGGGGG

with THIS:

\par \par


WITHOUT effecting any other text in the various fields where the string
appears?

Any advice would be greatly appreciated and would be a welcome learning
experience.

Thanks,
Robert
 
J

Jerry Porter

Hi Robert,

You could use the Replace function in a query. If you do it in VBA to
generate the query, it could look like this:

Sub ReplaceTextInTable()
Dim sOldString As String
Dim sNewString As String
Dim ssql As String

sOldString = "YYYYYYY\rtf1\ansi\deff0{\fontt­bl{\f0\froman\fprq2
Times New Roman;}{\f1" _
& vbNewLine & "\fnil Georgia;}}" _
& vbNewLine & "{\colortbl ;\red0\green0\blue0;}" _
& vbNewLine & "{\*\generator Riched20
5.40.11.2210;}\viewkind4\uc1\p­ard\li2320\cf1" _
& vbNewLine & "\lang1033\b\f0\GGGGGGG"
sNewString = "\par \par"

ssql = "Update MyTable Set MyField = Replace(MyField,'" &
sOldString & "','" & sNewString & "')"
CurrentDb.Execute ssql, dbFailOnError
End Sub

Or the SQL for the query it generates is:

Update MyTable Set MyField =
Replace(MyField,'YYYYYYY\rtf1\ansi\deff0{\fontt­bl{\f0\froman\fprq2
Times New Roman;}{\f1
\fnil Georgia;}}
{\colortbl ;\red0\green0\blue0;}
{\*\generator Riched20 5.40.11.2210;}\viewkind4\uc1\p­ard\li2320\cf1
\lang1033\b\f0\GGGGGGG','\par \par')

You may have to fiddle with text to get the carriage turns the way you
need them.

Jerry
 
G

Guest

Robert Brown said:
Ok,

I am working in Access 2003 with a MDB which has a table with around
26000 entries. One field contains some rtf data that I need to modify.

An Update query is the simplest way to do this. Create a query based on your
table; select the field that you want to edit; apply any criteria you need to
select which records should be updated. Change it to an Update query using
the Query menu option or the query type tool on the toolbar, and put the
desired new value on the Update To line. Run the query by clicking the ! icon.

John W. Vinson/MVP
 
D

david tanner

I am Lula Tanner, I am have promblem with my computerr and keep it up and
run all toghter. It seem like every time I think I have one thing fix
something else go worng. It run so slow that my I type faster then it do.
 
J

John Vinson

I am Lula Tanner, I am have promblem with my computerr and keep it up and
run all toghter. It seem like every time I think I have one thing fix
something else go worng. It run so slow that my I type faster then it do.

Lula, you're asking your question in the wrong place. You asked for
help in a "Newsgroup", which is like a bulletin board for people who
want help with a particular program called Microsoft Access. This
isn't a place to ask for help about general computer problems.

I have no idea what is wrong with your computer or even what programs
you are trying to run, so I can only guess at what might be wrong. You
may have viruses or "adware" on your computer; are you running a good
antivirus program? If not, DO.

You will probably need to find somebody local to look at your computer
and figure out what is wrong. Good luck.

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top