Campo demasiado pequeño

Caliche

Active Member
Joined
Mar 26, 2002
Messages
339
Tratando de insertar valores en una celda de Excel por medio de un textbox de un formulario cuyo texto excede de 255 caracteres, me presenta el siguiente mensaje de error:

"Se ha producido el error ' -2147217833(80040e57)' en tiempo de ejecución:

El campo es demasiado pequeño para aceptar la cantidad de datos que intenta agregar. Intente insertar o pegar menos datos".

NOTA: el mensaje de error se presenta en la instrucción (ver código completo mas abajo)

Code:
 cnExcel.Execute (strSQL)
Si el texto del textbox es de menos de 255 caracteres, la consulta funciona correctamente.Es importante aclarar que estamos probando nuestro código sólo con el campo "PNec1".

Cualquier ayuda para resolver esta situación es bienvenida.

Muchas gracias por su colaboración.

Caliche

CODIGO:
Code:
Public Function IngresarDatosGenerales(Responsable As String, Fecha As String, Cliente As String, Telefono As String, Direccion As String, Ciudad As String, Integrantes As String, PNec1 As String, PNec2 As String, PNec3 As String, PNec4 As String, PNec5 As String, PNec6 As String, PNec7 As String, PNec8 As String, PNec9 As String, PNec10 As String, PNec11 As String, PNec12 As String, PNec13 As String, PNec131 As String, PNec14 As String, PNec15 As String)
Dim rsConsecutivo As ADODB.Recordset
Dim Consecutivo, ConsecutivoAsignado, intFilas, pf As Integer, pc As Integer, uc As Integer
Dim uf As Long
 
Consecutivo = 0
EstablecerConexion
cnExcel.Open
Set rsConsecutivo = New ADODB.Recordset
With rsConsecutivo
.ActiveConnection = cnExcel
.Open "Select Max(Val(Consecutivo)) + 1 from RngDatos"
Consecutivo = IIf(IsNull(.Fields(0).Value), 1, .Fields(0).Value)
.Close
End With
 
strSQL = "INSERT INTO RngDatos (Consecutivo,Responsable,Fecha,Cliente,Telefono,Direccion,Ciudad,Integrantes,PNec1,PNec2,PNec3,PNec4,PNec5,PNec6,PNec7,PNec8,PNec9,PNec10,PNec11,PNec12,PNec13,PNec131,PNec14,PNec15)"
strSQL = strSQL & " values (" & Consecutivo & ",'" & Responsable & "','" & Fecha & "','" & Cliente & "','" & Telefono & "','" & Direccion & "','" & Ciudad & "','" & Integrantes & "','" & PNec1 & "','" & PNec2 & "','" & PNec3 & "','" & PNec4 & "','" & PNec5 & "','" & PNec6 & "','" & PNec7 & "','" & PNec8 & "','" & PNec9 & "','" & PNec10 & "','" & PNec11 & "','" & PNec12 & "','" & PNec13 & "','" & PNec131 & "','" & PNec14 & "','" & PNec15 & "')"
 
 
cnExcel.Execute (strSQL) 'ACA SACA EL ERROR MOSTRADO EN LA IMAGEN
 
cnExcel.Close
ConsecutivoAsignado = Consecutivo 
 
End Function
 
Last edited by a moderator:

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,223,978
Messages
6,175,754
Members
452,667
Latest member
vanessavalentino83

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top