Pulling file out of database 
Author Message
 Pulling file out of database

I have an Access database than contains JPEG images in a Long Binary
format.  Is there any way to access this data and save it to a regular
JPEG file?  I can map an Image or Picture control to the data, which
will give me a correct graphical display, but these controls only allow
for saving in bitmap format. HELP!
Feel free to mail me directly.



Fri, 31 Mar 2000 03:00:00 GMT  
 Pulling file out of database


Quote:
>In my Access database, one of the table has a binary field in it.  I think
>it is a picture. I would like to be able to save it to a local file. Any
>idea how? Thanks!

if you use GetRows to return a variant array which contains variants of
every field, pass the individual field you want to this function:
(you could also use GetChunk to do the same thing, but I load stuff in one
GetRows in batches of rows)
Private Function LoadFigure(varBytes As Variant) As Boolean
    Const cstrFilename As String = "\figure.wmf"
    Dim strFilename As String, lngFilenumber As Long, bytBuffer() As Byte
    On Error GoTo ErrorTrap
    If Not IsNull(varBytes) Then
        'must pull real bytes out of padded variant for Put function
        bytBuffer = varBytes
        'write data to temporary file
        strFilename = Environ("TEMP")
        If strFilename = "" Then strFilename = Environ("TMP")
        If strFilename = "" Then strFilename = "C:"
        strFilename = strFilename & cstrFilename
        lngFilenumber = FreeFile
        Open strFilename For Binary Access Write As #lngFilenumber
        Put #lngFilenumber, , bytBuffer
        Close #lngFilenumber
        Set ... = LoadPicture(strFilename)   'this line was modified for
this example
        Kill strFilename
        LoadFigure= True
    End If
    Exit Function
ErrorTrap:
    Resume ErrorTrap2
ErrorTrap2:
    On Error Resume Next
    Close #lngFilenumber
End Function
Quote:

>I have an Access database than contains JPEG images in a Long Binary
>format.  Is there any way to access this data and save it to a regular
>JPEG file?  I can map an Image or Picture control to the data, which
>will give me a correct graphical display, but these controls only allow
>for saving in bitmap format. HELP!
>Feel free to mail me directly.



Tue, 04 Apr 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Pulling file out of database

2. query to link or join/pull information from databases

3. pulling info from a database helllllllp

4. ?Trouble Pulling information from Database

5. pulling fewer rows from a database

6. Pulling random records from a database, without duplication

7. Pulling a paragraph from the database

8. How to pull data from an Access Database into a VBA Form

9. How can I generate a pull down menu with database data at run time

10. Pulling data from two different databases

11. How to pull data from an Access Database into a VBA Form

12. Pulling Random Records from a Database

 

 
Powered by phpBB® Forum Software