Results 1 to 8 of 8
  1. #1
    Lounger
    Join Date
    May 2004
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Reading rtf files into Access (2003)

    I need to include the contents of many .rft files in an Access report. I have been searching through the forum and haven't found quite what I was looking for. The only idea I have is to automate Word, loop through the files and save the contents of each one in a memo field in a table. All the files are in one location and the names are all the same format with a file number included in the name. Does anyone have any other ideas? Any help or suggestions would really be appreciated.

    Thanks,

    Kevin

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

    Re: Reading rtf files into Access (2003)

    How are you going to display the .rtf files on the report? I don't have Access 2003, but in earlier versions, the Microsoft Rich Textbox Control cannot be used on a report - see ACC2000: Contents of Rich TextBox Control Not Viewable in Report.

    You could use code to print the .rtf files from Access (they will probably be printed by Word.)

  3. #3
    Lounger
    Join Date
    May 2004
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reading rtf files into Access (2003)

    Wow! That was fast! I guess I thought I would use a text box but is there another control that should be used? The contents of each file is related to and will be displayed with records from another table.

  4. #4
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Reading rtf files into Access (2003)

    The problem is that RTF characters won't be displayed in a standard Access text box. I would suggest you look at creating an Automation report in Word, opening the RTF file and then putting the data from the associated record into the Word document, along with the appropriate labels, etc. In your Access record you would simply store the name of the related file (and perhaps it's path).
    Wendell

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

    Re: Reading rtf files into Access (2003)

    Text boxes won't display .rtf files correctly - they display the RTF source instead of the formatted text.

    The MSKB article I posted a link to contains a reference to a third-party memo control that can be used in a report. I haven't tried it myself.

  6. #6
    Lounger
    Join Date
    May 2004
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reading rtf files into Access (2003)

    Thanks Wendell. Would you put the data and the contents of the .rtf file into cells in a Word table?

    Kevin

  7. #7
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Reading rtf files into Access (2003)

    You could do it that way, or you could use bookmarks, or even a Word template that contained all the headings and labels. In many cases it might make sense to use a table as well as bookmarks, as tables often make formatting easier. It probably depends mostly on the format that the report is required to present.
    Wendell

  8. #8
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Reading rtf files into Access (2003)

    I have used rich text controls to display the contents of rtf files on forms a bit, but I haven't done it on reports. I find them very quick - just set the filename property to the full path of the rtf file and the contents appear instantly.

    This thread prompted me to try using them in reports, so I saved a form as a report, and as the article Hans referred to says, you can't print preview the rtf, however you can actually print it ok. You don't seem to be able to set a can grow/shrink properties, so I imagine this would create problems.
    Regards
    John



Posting Permissions

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