Results 1 to 2 of 2
  1. #1
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Australia
    Posts
    676
    Thanks
    28
    Thanked 2 Times in 2 Posts

    Finding special characters (Access 2000)

    I need to find and remove all the line breaks in a text field. I tried using ^p (paragraph mark) and ^l (line break) as in Word, as a search parameter and as a query criterion, but it didn't work. How can I do this?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Finding special characters (Access 2000)

    You can't enter a line break in the Find/Replace dialog. You'll need an update query and a user-defined function

    1) Create a new module and copy the following code into it:
    <code>
    Function NoBreaks(val As Variant) As Variant
    If IsNull(val) Then
    NoBreaks = Null
    Else
    NoBreaks = Replace(val, vbCrLf, "")
    End If
    End Function
    </code>
    2) Create a query based on the table and add the text field to the query grid.
    Select Query | Update Query.
    Enter the following in the 'Update to' line, with the appropriate field name substituted:
    <code>
    NoBreaks([NameOfTheField])
    </code>
    3) Run the update query.

Posting Permissions

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