hi RB,

I have a sample on how to save binary to db. I do not know who made this sample, and I have never tried it, but hopefully it will get you started.

VB Code:
  1. Function SaveFileToDB(sSource As String, BynaryField As Field) As Integer
  2.  
  3.    Dim nNumBlocks       As Integer
  4.    Dim nFile            As Integer
  5.    Dim nI               As Integer
  6.    Dim nFileLen         As Long
  7.    Dim nLeftOver        As Long
  8.    Dim sFileData        As String
  9.    Dim Retval           As Variant
  10.    Dim nBlockSize       As Long
  11.  
  12.    On Error GoTo Error_SaveFileToDB
  13.  
  14.    nBlockSize = 32000    ' Set size of chunk.
  15.  
  16.    '--
  17.    'Open the sSource file.
  18.    '--
  19.    nFile = FreeFile
  20.    Open sSource For Binary Access Read As nFile
  21.  
  22.    '--
  23.    'Get the length of the file.
  24.    '--
  25.    nFileLen = LOF(nFile)
  26.    If nFileLen = 0 Then
  27.       SaveFileToDB = 0
  28.       Exit Function
  29.    End If
  30.  
  31.    '--
  32.    'Calculate the number of blocks to read and nLeftOver bytes.
  33.    '--
  34.    nNumBlocks = nFileLen \ nBlockSize
  35.    nLeftOver = nFileLen Mod nBlockSize
  36.  
  37.    '--
  38.    'Read the nLeftOver data, writing it to the table.
  39.    '--
  40.    sFileData = String$(nLeftOver, 32)
  41.    Get nFile, , sFileData
  42.    BynaryField.AppendChunk (sFileData)
  43.  
  44.    '--
  45.    'Read the remaining blocks of data, writing them to the table.
  46.    '--
  47.    sFileData = String$(nBlockSize, Chr$(32))
  48.    For nI = 1 To nNumBlocks
  49.       Get nFile, , sFileData
  50.       BynaryField.AppendChunk (sFileData)
  51.    Next
  52.    Close #nFile
  53.    SaveFileToDB = nFileLen
  54.  
  55.    Exit Function
  56.  
  57. Error_SaveFileToDB:
  58.    SaveFileToDB = -Err
  59.    Exit Function
  60.    
  61. End Function