dbTalk Databases Forums  

Search/Replace problem

comp.database.ms-access comp.database.ms-access


Discuss Search/Replace problem in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
magmike
 
Posts: n/a

Default Search/Replace problem - 02-17-2005 , 12:30 AM






A few years ago, I did something very stupid. Because I didn't know how to
code in a carriage return on my website, and because the memo fields were
displaying on my webpage without the carriage returns, I asked users of my
site to use a double asterick ("**") to represent a new paragraph.

Well, eventually, I learned how to code my database results, so that the
carriage returns they put in the database, would display on the page. Only
one issue remained. Deleting the double astericks in the database from the
10,000+ records. When I do my search/replace - I think it thinks I am using
a wildcard, as it tells me the database has been searched and the item not
found. I even tried enclosing the double astericks in quotations, but I
still get the same error.

Am I screwed?

Mike

--
MEDICATION ASSISTANCE PROGRAM
Qualifying applicants get their medication free.
It's easy to qualify. Use the qualification wizard at
http://www.rexaid.com






Reply With Quote
  #2  
Old   
Ira Solomon
 
Posts: n/a

Default Re: Search/Replace problem - 02-17-2005 , 03:31 PM






Mike:

Don't despair.

Copy the following code into a module:

Public Sub FixDouble()
Dim rs As DAO.Recordset
Dim mstr, newstr, crlf As String
Dim db As DAO.Database
Set db = CurrentDb
Set rs = db.OpenRecordset("tdouble")
crlf = vbCrLf
Do While Not rs.EOF
rs.Edit
mstr = rs("test")
newstr = Replace(mstr, "**", crlf)
rs("test") = newstr
rs.Update
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
End Sub

Replace the tablename (tdouble) with your table, and the field name
(test) with your memo field name.
Before you run this check in Tools/References that you have a DAO
library checked. If not, find Microsoft DAO Library and check it.
The replaces ** with CR/LF but you could use anything you want.

Of course, make a copy of the db first. I tested this, but....

Good Luck
Ira Solomon






On Wed, 16 Feb 2005 22:30:19 -0800, "magmike"
<mike.klineDOESNT-LIKE-SPAM (AT) netterweb (DOT) com> wrote:

Quote:
A few years ago, I did something very stupid. Because I didn't know how to
code in a carriage return on my website, and because the memo fields were
displaying on my webpage without the carriage returns, I asked users of my
site to use a double asterick ("**") to represent a new paragraph.

Well, eventually, I learned how to code my database results, so that the
carriage returns they put in the database, would display on the page. Only
one issue remained. Deleting the double astericks in the database from the
10,000+ records. When I do my search/replace - I think it thinks I am using
a wildcard, as it tells me the database has been searched and the item not
found. I even tried enclosing the double astericks in quotations, but I
still get the same error.

Am I screwed?

Mike


Reply With Quote
  #3  
Old   
magmike
 
Posts: n/a

Default Re: Search/Replace problem - 02-18-2005 , 12:48 AM



Beautiful. Just beautiful.

Thanks!
mike



"Ira Solomon" <isolomon (AT) solomonltd (DOT) com> wrote

Quote:
Mike:

Don't despair.

Copy the following code into a module:

Public Sub FixDouble()
Dim rs As DAO.Recordset
Dim mstr, newstr, crlf As String
Dim db As DAO.Database
Set db = CurrentDb
Set rs = db.OpenRecordset("tdouble")
crlf = vbCrLf
Do While Not rs.EOF
rs.Edit
mstr = rs("test")
newstr = Replace(mstr, "**", crlf)
rs("test") = newstr
rs.Update
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
End Sub

Replace the tablename (tdouble) with your table, and the field name
(test) with your memo field name.
Before you run this check in Tools/References that you have a DAO
library checked. If not, find Microsoft DAO Library and check it.
The replaces ** with CR/LF but you could use anything you want.

Of course, make a copy of the db first. I tested this, but....

Good Luck
Ira Solomon






On Wed, 16 Feb 2005 22:30:19 -0800, "magmike"
mike.klineDOESNT-LIKE-SPAM (AT) netterweb (DOT) com> wrote:

A few years ago, I did something very stupid. Because I didn't know how to
code in a carriage return on my website, and because the memo fields were
displaying on my webpage without the carriage returns, I asked users of my
site to use a double asterick ("**") to represent a new paragraph.

Well, eventually, I learned how to code my database results, so that the
carriage returns they put in the database, would display on the page. Only
one issue remained. Deleting the double astericks in the database from the
10,000+ records. When I do my search/replace - I think it thinks I am
using
a wildcard, as it tells me the database has been searched and the item not
found. I even tried enclosing the double astericks in quotations, but I
still get the same error.

Am I screwed?

Mike




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.