Save RTF to Access Database


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 11 of 11

Thread: Save RTF to Access Database

  1. #1
    Join Date
    Aug 2004
    Posts
    54

    Exclamation Save RTF to Access Database

    HI,
    I was wondering if there a way to save a RTF to MS Access. What I am trying to do, is to allow the user to enter a text where he can have some words either: Bold, Underlined,ect... or also he can have some of the words in Red or other color. all the formatted text will be save into a database, then whenever he retrieves the text from the data, the text will be formatted the way he save it in the first place...
    Thank you,

  2. #2
    Join Date
    Aug 2004
    Location
    Orange, California
    Posts
    1,263
    Yes you can. The TextRTF property of the RichTextBox Control contains all of the RTF needed. You can use a Memo Field to store the text. A regular text field only holds up to 255 characters, so including all of the rtf codes, it would not hold much.

  3. #3
    Join Date
    Aug 2004
    Posts
    54
    thanks for the reply,
    can you please post a sample on how to get it done, because I am not really familiar with RicthText control.
    Thank you

  4. #4
    Join Date
    Aug 2004
    Location
    Orange, California
    Posts
    1,263
    I don't have any examples I can show you; But you can search in
    FreeVBCode.com
    See if there are any examples there.
    Also check out the MSDN documentation on the control itself.
    RichTextBox Control

    The control also supports databinding just like a regular text box. Get your application working first. Make sure everything updates to the database correctly. Just use a RichTextBox on the field where you want the extra formatting. Then use the information you find above to code the formatting routines.

    Once you get that far we can help you more.

    Here are some examples of database apps in VB, One from freeVBCode.com, uses DAO, and One from The Planet Source Code, uses ADO. I have not looked at these projects so I don't know if they are any good; but It's a place to start.
    Database Application Demo for Beginners
    A Complete ADO Code Database Programming

    Get as far as you can and then just create another post here if you get stuck. We will be gald to help.

  5. #5
    Join Date
    Jan 2012
    Posts
    4

    Question Problem with RTF-to-Access

    Hi,

    I have a problem regarding this very issue. I have a RichTextBox that i store in a RTF-formatted memo field in MS Access; however, the the text that gets stored in the DB loses all its formatting.
    Is there any way that I can store the RTF in MS Access without losing the formatting?

    Any help would be greatly appreciated.

    Thank You!

  6. #6
    Join Date
    Aug 2004
    Location
    Orange, California
    Posts
    1,263
    Sounds Like only the text is being saved in the memo field.
    Try unbinding from the ritchtextbox control Then
    Add an AfterUpdate Event Handler where you assign the memo Field directly with the value from the RitchTectBox Control's TextRTF Property.
    Also add to the On Current Event Handler to set the TextRTF property to the value from the memo filed.

  7. #7
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Does this help?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  8. #8
    Join Date
    Jan 2012
    Posts
    4

    Adding the RTF to the MEMO field

    Hi Ron,

    Do you mean that i should add it to the DB using ADO.net?

  9. #9
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    ADO.NET? The code in the example link I posted is for Access VBA
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  10. #10
    Join Date
    Jan 2012
    Posts
    4
    .....OOPS! Sorry, i did not notice the link in your response...

  11. #11
    Join Date
    Jan 2012
    Posts
    4
    ...anyhow, my question was for vb.net, not VBA.

    Thanx anyways.

Similar Threads

  1. Replies: 1
    Last Post: 09-17-2002, 11:57 PM
  2. Replies: 6
    Last Post: 08-21-2000, 08:14 PM
  3. Save and Retrieve Picture In Access Database
    By Larry Rebich in forum VB Classic
    Replies: 3
    Last Post: 08-20-2000, 01:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center