I've got a mysql db on a server. In this db i have photos which i want to "download" to a jpg file format. I use a stream to write the data from a Access db to the mysql db, but when i reverse the process it creates a blank jpg file with no file size or photo in it. Can any one help me with this?

VB Code:
  1. Sub DBConnectMysql()
  2. Dim StrCnn As String
  3. Dim MySqlHost As String
  4. Dim MySqlDB As String
  5. Dim MySqlUser As String
  6. Dim MySqlPwd As String
  7.  
  8. MySqlHost = "########"
  9. MySqlDB = "#######"
  10. MySqlUser = "########"
  11. MySqlPwd = "########"
  12.  
  13. Set CnnM = New ADODB.Connection
  14.  
  15. StrCnn = "DRIVER={MySQL ODBC 3.51 Driver};" _
  16.     & "SERVER=" & MySqlHost & ";" _
  17.     & "DATABASE=" & MySqlDB & ";" _
  18.     & "UID=" & MySqlUser & ";" _
  19.     & "PWD=" & MySqlPwd & ";" _
  20.     & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
  21.  
  22. CnnM.Open StrCnn
  23. Set cmdM = New ADODB.Command
  24. Set cmdM.ActiveConnection = CnnM
  25. End Sub
  26.  
  27.  
  28. If Not IsNull(RSM(3)) Then                
  29. Set cnnConnection = New ADODB.Connection        
  30. PhotoM = RSM(3)                
  31. strStream.Type = adTypeBinary                  
  32. cnnConnection.Open ("Provider=Microsoft.Jet.OLEDB.4.0;" & _          
  33.    "Data Source=" & ("c:\work\PDE\3dPropMan.mdb") & ";Jet OLEDB:Database Password=3DCla55jul24")                
  34.  
  35. Set rstRecordset = New ADODB.Recordset                  
  36. rstRecordset.Open "Select Photo from Photos where Code = " & RSM(0) & " and ListingCode = '" & RSM(1) & "' and SiteCode = '" & RSM(4) & "'" _        
  37. , cnnConnection, adOpenKeyset, adLockOptimistic                    
  38. Set strStream = New ADODB.Stream          
  39. strStream.Type = adTypeBinary          
  40. strStream.Open          
  41. strStream.Write RSM(3)          
  42. strStream.SaveToFile "c:\work\PDE\Photos\" & RSM(0) & " " & RSM(4) & ".jpg", adSaveCreateOverWrite          
  43.                    
  44. strStream.Close                    
  45. cnnConnection.Close              
  46. End If