Click here to Skip to main content
15,881,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to store an image in MS Access Data Table. and what is the table structure
Posted

try the following code

Dim cn As ADODB.Connection
Set cn = CurrentProject.Connection
Dim RS As ADODB.Recordset
Dim mstream As ADODB.Stream
Dim strQry As String

strQry="SELECT [picturefieldname] FROM [tablename] WHERE [primaryfieldname]=primaryfieldvalue"

Set RS = New ADODB.Recordset
With RS
   .LockType = adLockOptimistic
   .CursorLocation = adUseClient
   .CursorType = adOpenDynamic
   .Open strQry, cn
End With
    
Set mstream = New ADODB.Stream
mstream.Open
mstream.Type = adTypeBinary
mstream.LoadFromFile FilePathAndName
RS.Fields(PictureFieldName) = mstream.Read
RS.Update
 
Share this answer
 
v2
Comments
[no name] 17-Jun-14 5:45am    
please explain the reason who have downvoted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900