Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/09/2008, 16:07
clavijo83
 
Fecha de Ingreso: abril-2008
Mensajes: 40
Antigüedad: 16 años
Puntos: 0
como soluciono error 424 en tiempo de ejecucion

Hola a todos, resulta que cree una aplicacion que me trabajaba perfectamente hasta hace poco, que me mostro el error:

Error '424' en tiempo de ejcucion:
se requiere un Objeto

lo curioso es que el Software funcionaba bien y insertaba bien esta funcion, y mas curioso es porque funciona bien en las demas funciones, inserta datos, los actualiza y elimina.


aqui les agrego el codigo a ver si me pueden hacer el favor de ayudarme a solucionar este error.


Private Sub Form_Load()
Conexion
titulo_grillas
llena_grilla
End Sub

Private Sub insertar_operador()
Dim consulta As String
Dim Sentencia_usu As String
Set registro = New ADODB.Recordset
If (Text5.Text = "") Or (Text4.Text = "") Or (Text2.Text = "") Or (Text1.Text = "") Or (Text3.Text = "") Or (Text7.Text = "") Or (Text6.Text = "") Then
X = MsgBox("Se recomienda insertar datos validos en los campos",
vbOKOnly + vbCritical, "Error")
Else
Set registro = New ADODB.Recordset
consulta = "select * from operadores where CODIGO_OPERADOR ='" & _
Text5.Text & "' "
Set registro = conex.Execute(consulta)
If registro.EOF Then
Sentencia_usu = "insert into operadores (" & _
"CODIGO_OPERADOR,NOMBRE_OPERADOR,APELLIDO_OPERADOR ,
cargo,salario,DIRECCION,TELEFONO,codigo_tipo_usuar io)" & _
" values ('" & _
Text5.Text & "', '" & _
Text4.Text & "', '" & _
Text3.Text & "', '" & _
Text2.Text & "', " & _
Text1.Text & ", '" & _
Text6.Text & "', '" & _
Text7.Text & "', '" & _
Text9.Text & "', " & _
Text8.Text & ", '" & _
Text10.Text & "')"
conex.Execute (Sentencia_usu)
MsgBox "Operador registrado"
limpiar
Else
MsgBox " Este Operador ya existe!. Verifique "
limpiar
End If
End If
End Sub


y anexo el modulo de conexion tambien:


Public conex As ADODB.Connection
Public tabla As ADODB.Recordset

Public Sub Conexion()
' Realiza la conexion con la base de datos
On Error GoTo msgError
Set conex = New ADODB.Connection
Set tabla = New ADODB.Recordset
conex.CursorLocation = adUseClient
conex.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=storres;UID=root ;PWD=123;"
conex.Open
Exit Sub
msgError:
MsgBox Err.Number & " - " & Err.Description, vbCritical, "Error"
End Sub


agradeceria me podrian ayudar.

Public Sub cerrar()
conex.Close
End Sub