Storing Picture in Access using vb ( OLE Object DataType In Access)

Posted on 2005-03-11
Medium Priority
Last Modified: 2013-12-25
Can i know how to save a picture from a file or from sqlserver2000 database using vb.Basically i want to post pictures from sqlserver2000 to msaccess.but the datatype in access is ole object.
Thanks in advance
Question by:muddasani
1 Comment
LVL 75

Accepted Solution

Anthony Perkins earned 800 total points
ID: 13526252
Use this:

Sub AddImage(rs As ADODB.Recordset, ByVal FileName As String)
Dim stm As ADODB.Stream

Set stm = New ADODB.Stream
With stm
  .Type = adTypeBinary
  .LoadFromFile FileName
  'Insert the binary object into the table.
  rs.Fields("Image").Value = .Read
End With
Set stm = Nothing

End Sub

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month8 days, 1 hour left to enroll

616 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question