Results 1 to 8 of 8
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Formatting (Access 2002)

    Access apparently cannot handle Tab characters when cutting and pasting from Word...each tab shows up as a little square in the table, form or report. Is there any easy way around this? Can Tabs be converted to ordinary spacing either in Access or in the Word file?

    Roger

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Formatting (Access 2002)

    Roger,
    In the BeforeUpdate event of the form insert :

    Me!ControlWithtabs = Replace(Me!ControlWithTabs, vbTab, " ")

    Francois
    Francois

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Formatting (Access 2002)

    When you paste text into Access, you get the literal value of the text, which includes the non-printing characters for Tab. Word's inner workings translate the tab characters for you, but Access simply stores what it sees as data, including the non-printing characters. Try Francois's method.
    Charlotte

  4. #4
    2 Star Lounger
    Join Date
    Jan 2001
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Formatting (Access 2002)

    Unfortunately I know very little about coding. I have put the code you supplied into the form as follows-

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    Me!ControlWithTabs = Replace(Me!ControlWithTabs, vbTab, " ")
    End Sub

    but it comes up with an error..."microsoft can't find the expression ControlWithTabs"

    What am I doing wrong?

    Roger

  5. #5
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Formatting (Access 2002)

    Roger,

    You have to replace ControlWithTabs with the name of your text box.
    If your text box has the name text23 (Like Microsoft like to name controls) then the line has to be:
    Me!text23 = Replace(Me!text23 , vbTab, " ")
    This has to be the name of the control with the tabs in it
    If you have more than 1 control with Tabs, you have to add a line for each control., like this:
    Me!text1 = Replace(Me!text1 , vbTab, " ")
    Me!text2 = Replace(Me!text2 , vbTab, " ")
    Me!text3 = Replace(Me!text3 , vbTab, " ")

    Francois
    Francois

  6. #6
    2 Star Lounger
    Join Date
    Jan 2001
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Formatting (Access 2002)

    OK..done that and the coding is now...
    Private Sub strDescription_BeforeUpdate(Cancel As Integer)
    Me!strDescription = Replace(Me!strDescription, vbTab, " ")
    End Sub

    but it still doesn't work. Pasting shows the non-printable characters and then when I go out of the form I get a debug error saying "the macro or function in the Before Update event is preventing microsoft from saving the data"

    Roger

  7. #7
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Formatting (Access 2002)

    Roger,

    You have to insert the code in the BeforeUpdate of your form and not in the BeforeUpdate of the strDescription control.

    Francois
    Francois

  8. #8
    2 Star Lounger
    Join Date
    Jan 2001
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Formatting (Access 2002)

    Thanks...got it at last!

    Roger

Posting Permissions

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