Controlar Error
Publicado por yanira (140 intervenciones) el 03/11/2006 14:32:29
Esta es una parte de una funcion
With tabla
Do While Not .EOF
Texto = "PARAMETERS FINICIAL DateTime, FFINAL DateTime; " & _
"INSERT INTO NOVEDADES (IDNovedad,IDTipoDoc,NumDocumento,IDTipoPersona,DANE,Institucion,IDTipoNovedad,FechaInicio,FechaFin,IDArea,IDNivel,IDJornada,Sede,Observaciones,Usuario) " & _
"VALUES (" & ConsecutivoNovedad() & "," & .Fields("TipoDoc") & "," & .Fields("Documento") & "," & .Fields("TipoPer") & ",'" & .Fields("CodDANE") & "','" & .Fields("Colegio") & "','" & .Fields("Novedad") & "',[FINICIAL],[FFINAL],'" & .Fields("IDArea") & "'," & .Fields("IDNivel") & "," & .Fields("IDJornada") & ",'" & .Fields("Sede") & "','" & .Fields("Obs") & "','" & .Fields("Usu") & "')"
Set Agregar = DB.CreateQueryDef("", Texto)
Agregar.Parameters![FINICIAL] = .Fields("Inicio")
Agregar.Parameters![FFINAL] = .Fields("Fin")
Agregar.Execute
Resultado = Resultado + 1
.MoveNext
Loop
End With
Mientras todos los campos que voy a insertar en la tabla lleven valor no hay problema pero si hay algun campo vacio me genera un error como hago para que el si encuentra un error
salte el set Agregar y continue con el siguiente registro
With tabla
Do While Not .EOF
Texto = "PARAMETERS FINICIAL DateTime, FFINAL DateTime; " & _
"INSERT INTO NOVEDADES (IDNovedad,IDTipoDoc,NumDocumento,IDTipoPersona,DANE,Institucion,IDTipoNovedad,FechaInicio,FechaFin,IDArea,IDNivel,IDJornada,Sede,Observaciones,Usuario) " & _
"VALUES (" & ConsecutivoNovedad() & "," & .Fields("TipoDoc") & "," & .Fields("Documento") & "," & .Fields("TipoPer") & ",'" & .Fields("CodDANE") & "','" & .Fields("Colegio") & "','" & .Fields("Novedad") & "',[FINICIAL],[FFINAL],'" & .Fields("IDArea") & "'," & .Fields("IDNivel") & "," & .Fields("IDJornada") & ",'" & .Fields("Sede") & "','" & .Fields("Obs") & "','" & .Fields("Usu") & "')"
Set Agregar = DB.CreateQueryDef("", Texto)
Agregar.Parameters![FINICIAL] = .Fields("Inicio")
Agregar.Parameters![FFINAL] = .Fields("Fin")
Agregar.Execute
Resultado = Resultado + 1
.MoveNext
Loop
End With
Mientras todos los campos que voy a insertar en la tabla lleven valor no hay problema pero si hay algun campo vacio me genera un error como hago para que el si encuentra un error
salte el set Agregar y continue con el siguiente registro
Valora esta pregunta


0