JamesMoffitt
MIS
I have an access table that contains binary data in a field. Such things as PDF's, TIF's, and PaperPort .max documents. I want to extract them, but I can't seem to get the code right. The below seems to run through, but the resulting file is corrupted.
Function extractfile()
Dim db As Database
Set db = CurrentDb()
Dim rstFile As Recordset
Set rstFile = db.OpenRecordset("File", dbOpenDynaset)
Dim data As Variant
data = rstFile!File_Data
rstFile.MoveFirst
Open "c:\testfile.max" For Binary Access Write As #1
Put #1, , data
'Write #1, data
Close #1
And yes, the first record in the table is a max document.
The Write #1, data line fails with an error "Bad File Mode"
Any Ideas?
James
Function extractfile()
Dim db As Database
Set db = CurrentDb()
Dim rstFile As Recordset
Set rstFile = db.OpenRecordset("File", dbOpenDynaset)
Dim data As Variant
data = rstFile!File_Data
rstFile.MoveFirst
Open "c:\testfile.max" For Binary Access Write As #1
Put #1, , data
'Write #1, data
Close #1
And yes, the first record in the table is a max document.
The Write #1, data line fails with an error "Bad File Mode"
Any Ideas?
James