• Replace Characters (A2k7 SP1)

    • This topic has 4 replies, 2 voices, and was last updated 17 years ago.
    Author
    Topic
    #450751

    Hi All,
    I have tried to replace the little square boxes in the VersionString from a SQL Server (AccessFormat.jpg in the attached zip file as displayed in an Access textbox) with a vbCrLf during an INSERT INTO (to hopefully keep most of the formatting) with coding like these:

    Replace(strVersionString, Chr(13) & Chr(10), vbCrLf)
    Replace(strVersionString, Chr(13) & Chr(10), & vbCrLf &)
    and a couple of other iterations which have not been successful.

    (Picture WordFormat.jpg in the attached zip file is for your info as to how the VersionString appears in Word.)

    Would someone please enlighten me in the proper method?
    Thank you.

    Viewing 0 reply threads
    Author
    Replies
    • #1108090

      In the first place, vbCrLf = Chr(13) & Chr(10), so replacing Chr(13) & Chr(10) with vbCrLf won’t do anything.
      In the Word picture, you can see that the second character is a tab character vbTab = Chr(9). Try the following:

      strVersionString = Replace(strVersionString, vbTab, “”)

      This should remove the tab characters. Next, if you want to want to see the carriage returns in Access, try

      strVersionString = Replace(strVersionString, vbCr, vbCrLf)

      If that doesn’t work, try

      strVersionString = Replace(strVersionString, vbLf, vbCrLf)

      If you want to remove the carriage returns, use “” instead of vbCrLf

      • #1108098

        Thanks Hans,
        Here’s what I used:

        Replace(strVersionString, vbLf & vbTab, vbCrLf)

        • #1108100

          That the most efficient way. I suggested separate replacements to be able to troubleshoot.

    Viewing 0 reply threads
    Reply To: Replace Characters (A2k7 SP1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: