Solved

Row cannot be located for updating (VB6 + MySQL)

Posted on 2014-01-29
6
1,280 Views
Last Modified: 2014-02-04
Hi guys,

I'm having a problem when I tried to update a record on MySQL table, even if I don't change any data on the form.

I have made a lot of applications with the same code but this is the first time I got this error.

Run-time error '2147217861(80040e38)':

Row cannot be located for updating. Some values may have been changed since it was last read.

*****************CODE**************
        Set rsTransacciones = New ADODB.Recordset
        cSQLActualiza = "SELECT * FROM Transacciones WHERE Clave = '" & npClaveRegistro & "'"
        rsTransacciones.Open cSQLActualiza, conn, adOpenStatic, adLockOptimistic
        
        If Not (rsTransacciones.BOF And rsTransacciones.EOF) Then
            rsTransacciones!Num_expediente = Trim(txtNumExpediente.Text)
            rsTransacciones!Nombre = Trim(txtNombre.Text)
            rsTransacciones!Paterno = Trim(txtPaterno.Text)
            rsTransacciones!Materno = Trim(txtMaterno.Text)
            rsTransacciones!Tipo_tramite = Trim(txtTramite.Text)
            rsTransacciones!Numero_oficio = Trim(txtNumeroDocto.Text)
            rsTransacciones!Autoridad_remitente = Trim(txtAutoridadRemitente.Text)
            rsTransacciones!Ciudad_residencia = Trim(txtCiudad.Text)
            rsTransacciones!Autoridad_solicita = Trim(txtAutoridadSolicita.Text)
            rsTransacciones!Promovente = Trim(txtPromovente.Text)
            rsTransacciones!Solicitud = Trim(txtSolicitud.Text)
            rsTransacciones!Seguimiento = Trim(txtSeguimiento.Text)
            rsTransacciones!Usuario_actualiza = cgUsuario
            rsTransacciones!Fecha_actualiza = Format(Date, "yyyy-mm-dd")
            rsTransacciones!Hora_actualiza = Format(Time, "hh:mm:ss")
            If chkConcluir.Value > 1 Then
                rsTransacciones!Estatus = "C"
                rsTransacciones!Usuario_concluye = cgUsuario
                rsTransacciones!Fecha_concluye = Format(Date, "yyyy-mm-dd")
                rsTransacciones!Hora_concluye = Format(Time, "hh:mm:ss")
            Else
                rsTransacciones!Estatus = "A"
            End If
            rsTransacciones.Update
        Else
            MsgBox "NO SE ENCONTRO EL REGISTRO PARA ACTUALIZAR", vbCritical, "Atención"
            frmActualizaciones.MousePointer = 0
            Exit Sub
        End If

Open in new window

***************************************

I Hope you guys can help me on this problem.

thanks' in advance.
0
Comment
Question by:elm9999
  • 4
6 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 39820256
I would use adOpenKeyset instead of adOpenStatic...
does the table have a primary key?
0
 

Author Comment

by:elm9999
ID: 39821510
Thank you!

Yes Guy I have a primary key named Clave.
0
 

Accepted Solution

by:
elm9999 earned 0 total points
ID: 39822806
I already found the problem, it occurs on these lines:

            rsTransacciones!Fecha_actualiza = Format(Date, "yyyy-mm-dd")
            rsTransacciones!Hora_actualiza = Format(Time, "hh:mm:ss")
0
 

Author Comment

by:elm9999
ID: 39822813
I have not received any solution, so I did myself!
0
 

Author Closing Comment

by:elm9999
ID: 39832013
I have not received any solution, so I did myself!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sort in mysql based off of query param 4 30
transition to visual .net from vb6 5 61
MySQL limit and not so limited 13 36
restriction of entering a a page 5 31
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

756 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