|
-
Jun 27th, 2001, 12:37 PM
#1
Thread Starter
-= B u g S l a y e r =-
Saving rich text and word docs in Access db
Is this possible ?
Anyone done it or know about a tutorial ?
peet
-
Jun 27th, 2001, 12:38 PM
#2
Frenzied Member
you can save the contents of a word doc or a richtext into a memo field in Access database...
-
Jun 27th, 2001, 12:40 PM
#3
Thread Starter
-= B u g S l a y e r =-
hi there zuperman,
by content you mean the text only ?
peet
-
Jun 27th, 2001, 12:43 PM
#4
Frenzied Member
yep, u can store the text inside a memo field of a Access database...
-
Jun 27th, 2001, 01:53 PM
#5
Thread Starter
-= B u g S l a y e r =-
ok, but what I want to do is save it all, both text and formatting... I'v seen this done in an application a long time ago, and I know the application used Acces database. And I'm pretty sure they used VB3.0 to develop it...
Any Ideas ?
-
Jun 27th, 2001, 02:32 PM
#6
You need a field defined as OLEObject and use the 2 functions below
Example of use:
' Places file into database
setBLOB myRecordSet, "FileField", "c:\FileToAdd.rtf"
' Save file to disk
getBLOB myRecordSet, "FileField", "c:\FileToSaveto.rtf"
VB Code:
Public Sub getBLOB(RS As ADODB.Recordset, Field As String, Des As String)
Dim lngFieldSize As Long
Dim fileBytes() As Byte
Dim intFileHandle As Integer
intFileHandle = FreeFile
lngFieldSize = RS(Field).ActualSize
If lngFieldSize > 0 Then
fileBytes = RS(Field).GetChunk(lngFieldSize)
Open Des For Binary As intFileHandle
Put intFileHandle, , fileBytes
Close intFileHandle
End If
End Sub
Public Sub setBLOB(RS As ADODB.Recordset, Field As String, Source As String)
Dim fileBytes() As Byte
Dim intFileHandle As Integer
intFileHandle = FreeFile
Open Source For Binary As intFileHandle
fileBytes = InputB(LOF(intFileHandle) - 1, intFileHandle)
RS(Field).AppendChunk fileBytes
Close intFileHandle
End Sub
-
Jun 27th, 2001, 02:48 PM
#7
Thread Starter
-= B u g S l a y e r =-
ahhh... (this is not an aha as if I understood all that )
Thanks ATommasi !
I'll get right to it and test the code.
If u'r ever in Bergen, Norway, a beer will be waiting for you at the "Zacharias bryggen" (If you know the prices of beer in Norway you understand that I really appreciate your help!)
Thanks again.
peet
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
|