Variable de tipo object no establecida
Publicado por davidr (12 intervenciones) el 23/07/2007 09:41:05
Hola a todos,
estoy utilizando un objeto de tipo datacombo del siguiente modo:
Dim cnn1 As ADODB.Connection
Dim rsPersonal As ADODB.Recordset
Dim strCnn As String
Dim dcboPersonal As DataCombo
strCnn = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=Winplus;Data Source=NET5100"
Set cnn1 = New ADODB.Connection
cnn1.Open strCnn
' Abre la tabla Personal
Set rsPersonal = New ADODB.Recordset
With rsPersonal
.ActiveConnection = cnn1
.CursorType = adOpenStatic
.LockType = adLockReadOnly
.CursorLocation = adUseClient
.Open "select codigo, nombre, apellido1, apellido2 from personal
order by codigo"
End With
Set dcboPersonal.RowSource = rsPersonal
......
Al ejecutarlo me da el siguiente error:
Error '91' en tiempo de ejecución :
Variable de tipo Object o la variable de bloque With no está establecida
¿Alguien me puede decir cuál es el problema o cómo solucionarlo?
Gracias de antemano.
estoy utilizando un objeto de tipo datacombo del siguiente modo:
Dim cnn1 As ADODB.Connection
Dim rsPersonal As ADODB.Recordset
Dim strCnn As String
Dim dcboPersonal As DataCombo
strCnn = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=Winplus;Data Source=NET5100"
Set cnn1 = New ADODB.Connection
cnn1.Open strCnn
' Abre la tabla Personal
Set rsPersonal = New ADODB.Recordset
With rsPersonal
.ActiveConnection = cnn1
.CursorType = adOpenStatic
.LockType = adLockReadOnly
.CursorLocation = adUseClient
.Open "select codigo, nombre, apellido1, apellido2 from personal
order by codigo"
End With
Set dcboPersonal.RowSource = rsPersonal
......
Al ejecutarlo me da el siguiente error:
Error '91' en tiempo de ejecución :
Variable de tipo Object o la variable de bloque With no está establecida
¿Alguien me puede decir cuál es el problema o cómo solucionarlo?
Gracias de antemano.
Valora esta pregunta


0