Error al actualizar la BD
Publicado por criss (3 intervenciones) el 31/07/2006 22:15:58
Hola a todos los del foro, tengo un problema que me tiene muy preocupado y espero que puedan ayudarme.
la idea es adicionar un nuevo elemento a la tabla de una BD(en SQL Server), para ello antes realizo una verificacion si el dato a adicionar existe en la tabla si no existe el nuevo elemento debe ADICIONARSE sim embargo al realizar ADDNEW me sale el siguiente errror:
ERROR '3251' EN TIEMPO DE EJECUCION. eL RECORSET ACTUAL NO ADMITE ACTUALIZACIONES. PUEDE SER UNA LIMITACION O DEL TIPO DE BLOQUEO
para mas detalle les envio codigo
Private Sub btnAceptar_Nuevo_Click()
'''***RstNuevo' ESTA DECLARADO EN UN MODULO COMO PUBLICO
Set RstNuevo = Nothing
RstNuevo.Open "select * from Trimestre order by gestion,trimestre", Con, adOpenDynamic, adLockOptimistic
'verificar el nuevo trimestre o gestion a adicionar
If Me.Option1.Value Then
' Verifica condicones para Adicionar nueva gestion
If Len(Trim(Me.TxtNuevaGestion.Text)) <= 0 Then
MsgBox ("Error al introducir una nueva gestión")
Exit Sub
End If
RstNuevo.MoveFirst
While Not (RstNuevo.EOF)
If RstNuevo.Fields("gestion") = Me.TxtNuevaGestion.Text Then
MsgBox ("la nueva gestion ya existe")
Exit Sub
End If
RstNuevo.MoveNext
'RstNuevo.Find(
Wend
If RstNuevo.EOF Then
RstNuevo.AddNew '******LINEA DONDE SALE EL ERROR***********
RstNuevo!Gestion = Trim(Me.TxtNuevaGestion.Text)
RstNuevo!Trimestre = 0
RstNuevo.Update
RstNuevo.Close
End If
Else
If Me.Option1.Value Then
'Verifica condicones para adicionar nuevo trimestre a la ultima gestion
End If
End If
End Sub
la idea es adicionar un nuevo elemento a la tabla de una BD(en SQL Server), para ello antes realizo una verificacion si el dato a adicionar existe en la tabla si no existe el nuevo elemento debe ADICIONARSE sim embargo al realizar ADDNEW me sale el siguiente errror:
ERROR '3251' EN TIEMPO DE EJECUCION. eL RECORSET ACTUAL NO ADMITE ACTUALIZACIONES. PUEDE SER UNA LIMITACION O DEL TIPO DE BLOQUEO
para mas detalle les envio codigo
Private Sub btnAceptar_Nuevo_Click()
'''***RstNuevo' ESTA DECLARADO EN UN MODULO COMO PUBLICO
Set RstNuevo = Nothing
RstNuevo.Open "select * from Trimestre order by gestion,trimestre", Con, adOpenDynamic, adLockOptimistic
'verificar el nuevo trimestre o gestion a adicionar
If Me.Option1.Value Then
' Verifica condicones para Adicionar nueva gestion
If Len(Trim(Me.TxtNuevaGestion.Text)) <= 0 Then
MsgBox ("Error al introducir una nueva gestión")
Exit Sub
End If
RstNuevo.MoveFirst
While Not (RstNuevo.EOF)
If RstNuevo.Fields("gestion") = Me.TxtNuevaGestion.Text Then
MsgBox ("la nueva gestion ya existe")
Exit Sub
End If
RstNuevo.MoveNext
'RstNuevo.Find(
Wend
If RstNuevo.EOF Then
RstNuevo.AddNew '******LINEA DONDE SALE EL ERROR***********
RstNuevo!Gestion = Trim(Me.TxtNuevaGestion.Text)
RstNuevo!Trimestre = 0
RstNuevo.Update
RstNuevo.Close
End If
Else
If Me.Option1.Value Then
'Verifica condicones para adicionar nuevo trimestre a la ultima gestion
End If
End If
End Sub
Valora esta pregunta


0