|
-
Feb 10th, 2005, 10:23 PM
#1
Thread Starter
Junior Member
Storing Rich Text in a database
I want to store extracts from a web page or HTML-formatted email into my userform control (Rich Text Box) and then store the data into an Access database keeping the formatting. I've used a Memo field in the database.
Is this the correct way to do it?
|
+--Thief_
|
+--VB6
+--VB Dot Net
|
-
Feb 10th, 2005, 10:53 PM
#2
Re: Storing Rich Text in a database
Memo field wouldn't save any formating at all. What you need is OLE object type field so you can save entire file but you will need to create rtf file first.
Search forum for saving files in database.
-
Feb 11th, 2005, 12:55 AM
#3
Re: Storing Rich Text in a database
You could use a memo field if you save the RTF formatted string to it. To get the RTF string from a RichTextBox use the TextRTF property instead of the regular Text property.
-
Feb 13th, 2005, 05:18 PM
#4
Thread Starter
Junior Member
Re: Storing Rich Text in a database
 Originally Posted by RhinoBull
Memo field wouldn't save any formating at all. What you need is OLE object type field so you can save entire file but you will need to create rtf file first.
Search forum for saving files in database.
Had a look but couldn't find much on how to save the RTB dat to an RTF file then load it into Access. Have u got a link to sample code which could help me?
JA. Thanks for that. I'll give that a go too.
|
+--Thief_
|
+--VB6
+--VB Dot Net
|
-
Feb 13th, 2005, 05:47 PM
#5
Frenzied Member
Re: Storing Rich Text in a database
You could use a memo field if you save the RTF formatted string to it. To get the RTF string from a RichTextBox use the TextRTF property instead of the regular Text property.
Just do....
VB Code:
RS!Blob = RichTextBoxReference.TextRTF
The blob holds the complete rich text box text plus formatting.
.
-
Feb 13th, 2005, 08:05 PM
#6
Thread Starter
Junior Member
Re: Storing Rich Text in a database
 Originally Posted by David.Poundall
Just do....
VB Code:
RS!Blob = RichTextBoxReference.TextRTF
The blob holds the complete rich text box text plus formatting.
Thnx David. What's a "blob"? How is it setup in an Access table?
|
+--Thief_
|
+--VB6
+--VB Dot Net
|
-
Feb 13th, 2005, 08:11 PM
#7
Re: Storing Rich Text in a database
The binary field that holds files or images, or in your case, Richtext.
Substitute your fieldname, which you declare as a BLOB type.
-
Feb 13th, 2005, 08:26 PM
#8
Re: Storing Rich Text in a database
Actually, you don't need to use a Blob (and shouldn't in this case). Since the RTF text is nothing but a text you can use a memo field.
-
Feb 14th, 2005, 12:21 AM
#9
Thread Starter
Junior Member
Re: Storing Rich Text in a database
So do you think I can paste parts of a web page into a RTB exactly as it's displayed in MSIE and then have that saved to a memo field to be later displayed in all its original glory??
|
+--Thief_
|
+--VB6
+--VB Dot Net
|
-
Feb 14th, 2005, 12:25 AM
#10
Re: Storing Rich Text in a database
I think so, I have looked at RTF of my page, and it is viewable in Wordpad. In notepad, it is just text, except the inline image, which is binary.
-
Feb 14th, 2005, 04:05 AM
#11
Frenzied Member
Re: Storing Rich Text in a database
 Originally Posted by Joacim Andersson
Actually, you don't need to use a Blob (and shouldn't in this case). Since the RTF text is nothing but a text you can use a memo field.
Sorry - I name the fields as Blobs but you are quite correct - specifically the record is stored in a memo field. Apologies if it misled you Thief
-
Feb 14th, 2005, 04:11 AM
#12
Frenzied Member
Re: Storing Rich Text in a database
 Originally Posted by Thief_
So do you think I can paste parts of a web page into a RTB exactly as it's displayed in MSIE and then have that saved to a memo field to be later displayed in all its original glory?? 
If it is viewable in the RTB then you can save it. If you have images in there it may start to take up a lot of space in your databse though.
-
Feb 14th, 2005, 04:55 PM
#13
Thread Starter
Junior Member
Re: Storing Rich Text in a database
I've just checked how an RTB works with web page data, and it works, but it sucks more than anything when it comes to formatting.
I suppose what I need is some sort of web control which accepts the copy-paste off a web page, stores the info as HTML and when displayed, acts sorta like a web browser control.
Is there such a thing and if so, is there some sample code to show how it works?
|
+--Thief_
|
+--VB6
+--VB Dot Net
|
-
Feb 15th, 2005, 03:18 AM
#14
Frenzied Member
Re: Storing Rich Text in a database
No - afraid not. What's the background to what you are trying to do. Is it a project need or wishfull thinking?
-
Feb 15th, 2005, 04:25 PM
#15
Thread Starter
Junior Member
Re: Storing Rich Text in a database
Thanks David.
I'm the admin for a Message Handling System for the company. One of my roles is to develop a Knowledge Base of the errors we receive from the MHS system and document the fix.
The errors are presented to me via a web browser.
My aim is to copy a part of the web browser screen to the KB app then type in the resolution so that others can see how to fix the same problem in the future when new versions are distributed and similar problems arise.
|
+--Thief_
|
+--VB6
+--VB Dot Net
|
-
Feb 15th, 2005, 06:56 PM
#16
Re: Storing Rich Text in a database
maybe convert it to xml? except that it would strip out the formatting.
-
Feb 15th, 2005, 08:44 PM
#17
Re: Storing Rich Text in a database
 Originally Posted by RhinoBull
Memo field wouldn't save any formating at all. What you need is OLE object type field so you can save entire file but you will need to create rtf file first.
Search forum for saving files in database.
As I said: best bet is to save entire file ...
Take a look at this sample - it stores image file but logic would be the same:
http://www.vb-helper.com/howto_database_picture.html
-
Feb 15th, 2005, 09:50 PM
#18
Thread Starter
Junior Member
Re: Storing Rich Text in a database
Thanks Rhino,
How would I get the web-based data onto a control on a userform? What control will accept pasted (formatted) data?
|
+--Thief_
|
+--VB6
+--VB Dot Net
|
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|