Mando un codigo....Me manda error que el objeto esta abierto....ayudenme porfis....
"hola, fijence que estoy ya medio mal el sig. codigo me marca que el objeto esta abierto, y no puedo corregirle, porfavor si pueden checarlo y me dicen como le hago...gracias by"
On Error GoTo manejador
textos frmmantto, False
botones frmmantto, False
guardar.Enabled = True
Dim Clave As String
Dim bande As Boolean
Dim Mifecha
Mifecha = Date
cn.ConnectionTimeout = 100
cn.Open "inventario", "", ""
Clave = UCase(InputBox("Introduzca la clave del equipo que saldrá de mantenimiento", " BUSCAR EQUIPO ", "Escriba aquÃ"))
bus = "select * from ordenesmntto where omnusr ='" & Clave & "'"
Set rst = cn.Execute(bus)
Adodc1.Refresh
Do While Not Adodc1.Recordset.EOF
If Adodc1.Recordset!omnusr = Clave Then
enc = 1
Exit Do
Else
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
MsgBox ("Registro no existe")
botones frmmantto, True
'guardar.Enabled = True
enc = 0
End If
End If
Loop
Set rst = cn.Execute(bus)
If enc = 1 Then
While Not rst.EOF
fent = rst!omfent
fsal = rst!omfsal
Text7.Text = Mifecha
bande = True
rst.MoveNext
Wend
Else
Adodc1.Refresh
End If
If bande = True Then
'
bus2 = "select * from computadora where cmnusr ='" & Clave & "'"
Set RS1 = cn.Execute(bus2)
RS1.MoveFirst
While Not RS1.EOF
If RS1!cmnusr = Clave Then
RS1.LockType = adLockOptimistic
RS1.CursorType = adOpenDynamic
RS1.Open b5, cn, , , adCmdText
If RS1!cmmnto <> 0 Then
RS1!cmmnto = 0
RS1.Update
Set RS1 = Nothing
Else
MsgBox ("Ya está fuera de mantenimiento")
End If
Else
MsgBox ("El registro no se ha encontrdo")
End If
RS1.MoveNext
Wend
Set RS1 = Nothing
Else
MsgBox ("No ha ubicado el registro")
End If
'frmresumen.Label31 = count2
Set RS1 = Nothing
Set rst = Nothing
Set cn = Nothing
Exit Sub
manejador:
Set RS1 = Nothing
Set rst = Nothing
Set cn = Nothing
MsgBox (Err.Description)
End Sub
On Error GoTo manejador
textos frmmantto, False
botones frmmantto, False
guardar.Enabled = True
Dim Clave As String
Dim bande As Boolean
Dim Mifecha
Mifecha = Date
cn.ConnectionTimeout = 100
cn.Open "inventario", "", ""
Clave = UCase(InputBox("Introduzca la clave del equipo que saldrá de mantenimiento", " BUSCAR EQUIPO ", "Escriba aquÃ"))
bus = "select * from ordenesmntto where omnusr ='" & Clave & "'"
Set rst = cn.Execute(bus)
Adodc1.Refresh
Do While Not Adodc1.Recordset.EOF
If Adodc1.Recordset!omnusr = Clave Then
enc = 1
Exit Do
Else
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
MsgBox ("Registro no existe")
botones frmmantto, True
'guardar.Enabled = True
enc = 0
End If
End If
Loop
Set rst = cn.Execute(bus)
If enc = 1 Then
While Not rst.EOF
fent = rst!omfent
fsal = rst!omfsal
Text7.Text = Mifecha
bande = True
rst.MoveNext
Wend
Else
Adodc1.Refresh
End If
If bande = True Then
'
bus2 = "select * from computadora where cmnusr ='" & Clave & "'"
Set RS1 = cn.Execute(bus2)
RS1.MoveFirst
While Not RS1.EOF
If RS1!cmnusr = Clave Then
RS1.LockType = adLockOptimistic
RS1.CursorType = adOpenDynamic
RS1.Open b5, cn, , , adCmdText
If RS1!cmmnto <> 0 Then
RS1!cmmnto = 0
RS1.Update
Set RS1 = Nothing
Else
MsgBox ("Ya está fuera de mantenimiento")
End If
Else
MsgBox ("El registro no se ha encontrdo")
End If
RS1.MoveNext
Wend
Set RS1 = Nothing
Else
MsgBox ("No ha ubicado el registro")
End If
'frmresumen.Label31 = count2
Set RS1 = Nothing
Set rst = Nothing
Set cn = Nothing
Exit Sub
manejador:
Set RS1 = Nothing
Set rst = Nothing
Set cn = Nothing
MsgBox (Err.Description)
End Sub
Hola como estas ...... bueno sabes coger un codigo y entenderlo a la primer a no es lo mismo que trabajar un par de semanas en el ......... y si escribi es solo para tratar de guiar y te ayudes tu misma , colocale un punto de seguimiento al programa antes de este codigo y siguelo para ver donde es el error, si es en el objeto conexion tendras que cerrar
cn.close
para que luego cuando lo abras de nuevo no te error por que la conexion esta sindo utilizxada o esta abierta
Saludos y espero te ayude
cn.close
para que luego cuando lo abras de nuevo no te error por que la conexion esta sindo utilizxada o esta abierta
Saludos y espero te ayude
