[AccessD] Updating a bound image using VBA

Jim Lawrence accessd at shaw.ca
Wed Sep 6 19:40:54 CDT 2006


Hi David:

My first issues would be to have an image embedded in the database. It will
definitely limit the performance and needs special handling to use and
update. Personally, I would suggest that a url/directory string pointing to
the image file guarantees better performance, reliability and stops other
strange events that tend to bite.

If you have to have Images, in tables, you either use the Chunk method or
ADODB.Stream object to pull from the OLE field. Traditionally these tables
only store images.
 
HTH
Jim  

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David & Joanne
Gould
Sent: Wednesday, September 06, 2006 3:10 PM
To: Access Developers discussion and problem solving
Subject: [AccessD] Updating a bound image using VBA

I have a form for entering new movie stock into a Video Library database. 
This form also allows the user to update details for all copies of the 
title. Because of this the data is updated using code. One of the fields in 
the table is an image field. The code I am using is:

  'Update Movie Title Details
     Dim rsUpdateMovieTitleDetails As Recordset
     Dim strMovieName As String

     strMovieName = Forms![frmAddNewMovieStock]![cboSelectMovieTitle]

     Set rsUpdateMovieTitleDetails = New ADODB.Recordset
     rsUpdateMovieTitleDetails.ActiveConnection = CurrentProject.Connection
     rsUpdateMovieTitleDetails.Open "tblTitles", , adOpenKeyset, 
adLockOptimistic, adCmdTable

     'Loop through the recordset
     Do Until rsUpdateMovieTitleDetails.EOF
         If rsUpdateMovieTitleDetails.Fields("name") = strMovieName Then
             rsUpdateMovieTitleDetails.Fields("supplier") = Me.supplier
             rsUpdateMovieTitleDetails.Fields("rating") = Me.rating
             rsUpdateMovieTitleDetails.Fields("categoryName") =
Me.categoryName
             rsUpdateMovieTitleDetails.Fields("RentalTypeID") =
Me.RentalTypeID
             rsUpdateMovieTitleDetails.Fields("cover") = Me.oleCover
         End If
         rsUpdateMovieTitleDetails.MoveNext
     Loop
     rsUpdateMovieTitleDetails.Close

I keep getting this error message:

Multiple-step OLE DB operation generated errors. Check each OLE DB status 
value, if available. No work was done.

Can anyone explain to me what I can do about this?

TIA

David Gould
DG Solutions 


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list