el ejemplo original (y que no me funciona) es algo asi:
Private Sub Grabar_bien()
If txtcompleto.Text <> "" And txtdescripcion.Text <> "" Then
If MsgBox("Graba Bien", vbQuestion + vbYesNo, "Pregunta") = vbYes Then
Sql = "SELECT * FROM BIEN WHERE Codigo_bien = '" & txtcompleto.Text & "'"
Set Rs = New ADODB.Recordset: Rs.Open Sql, BaseDatos, adOpenDynamic, adLockOptimistic
If Not Rs.EOF Then
Sql1 = "insert into bien values('" & txtfam & "','" & lblfamilia.Caption & "','" & txtsubfam & "', '" & lblsubfam.Caption & "', '" & txttiposub & "', '" & lbltiposub.Caption & "', '" & txtcorrelativo & "', '" & txtcompleto & "', '" & txtalternativo & "', '" & txtdescripcion & "'," _
& " '" & txtcorto & "','" & txttemporada & "','" & lbltemporada.Caption & "','" & txtrut & "', '" & txtdv & "', '" & lblnombre.Caption & "', '" & txtanalisis & "', '" & lblanalisis.Caption & "', '" & txtdocumento & "', " _
& " '" & lbldocumento.Caption & "','" & txtnumdoc & "','" & txtunidad & "','" & lblunidad.Caption & "', " & txtvalororig & ", '" & txtmoneda & "', '" & lblmoneda.Caption & "', " & txttcambio & ", '" & txtfinanciam & "', " _
& " '" & lblfinancia.Caption & "','" & fechaCompra & "','" & txtcantidad & "','" & txtcorrelibro & "', '" & txttipodepre & "', '" & lbldepreciacion.Caption & "', '" & txtestado & "', '" & lblestado.Caption & "', '" & txtctaactivo & "', " _
& " '" & txtctadepre & "','" & txtctadepreacum & "','" & txtcta & "','" & txtzona & "', '" & lblzona.Caption & "', '" & txtSeccion & "', '" & lblSeccion.Caption & "', '" & txtsubseccion & "', '" & lblsubseccion.Caption & "', '" & txtcencosto & "', '" & lblcencosto.Caption & "', '" & txtcuartel & "', '" & lblcuartel.Caption & "', '" & txtrutencarg & "', '" & txtdvencarg & "', '" & lblencargado.Caption & "', " & txtVlibro & ", " & txtVresidual & ", '" & FechaIncorp & "', '" & FechaBaja & "', '" & txtseguro & "', '" & lblseguro.Caption & "', '" & txtpoliza & "', " _
& " '" & txtcorrmon & "','" & txtdepacum & "'," & txtvalorcorr & "," & txtamorcorr & ", '" & txtdepmensual & "', '" & txtvidautil & "', '" & txtultmesdep & "', '" & txtultanodep & "', '" & txtmesesdep & "', '" & TxtNota & "')"
Else
MsgBox "", vbExclamation, "Alerta"
End If
End If
Else
MsgBox "Debe crear el codigo antes de grabar", vbExclamation, "Alerta"
End If
End Sub
en el fondo no me ejecuta el insert, y no entiendo porqué. |