SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    May 2004
    Location
    Minneapolis
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Find and replace in Access

    Before I knew better, I replaced vbcrlf with <br> tags in the memo fields of my access database. I'm now redesigning the site and I am having trouble replacing the <br> tags with vbcrlf or chr(13).

    Here is what I've tried:

    (1) exporting the table to tab delimited, replacing <br> tags with ^p in MS word, but that screws up the fields when I import it back into access

    (2) find and replace in Access but there is no way to replace with vbcrlf or chr(13)
    Tim Bednar
    http://www.turtleinteractive.com/

  2. #2
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,625
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Have had to do this a time or two. Best way is a little vba script that updates the fields. Code would look something like this (NB: writing from memory, probably will need a few tweaks):

    Code:
    public function ReplaceText(TextToFind as string, TextToReplace as string, SourceText as Variant) as Variant
    
    ReplaceText=SourceText
    if not isnull(ReplaceText)
    ReplaceText=replace(cstr(ReplaceText),TextToFind,TextToReplace)
    end function
    Then just run an update query where you set the value of your memo field to the results of that function with appropriate parameters.

    WWB

  3. #3
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by timbednar
    find and replace in Access but there is no way to replace with vbcrlf or chr(13)
    Not true.
    Code:
    UPDATE TableName
    SET [FieldName] = REPLACE(FieldName,"<br>",CHR$(13) + CHR$(10))
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •