respuesta hola no te puedo explicar el codigo completo pero aqui tienes un ejemplo trabajo con ado preo to creo las conexiones es decir no utilizo el control adodc1 si no que hago lo siguiente
dim conexion as adodb.conexion
dim rs as adodb.recordset etc.
bueno aqui te paso el codigo
Private Sub Command3_Click()
Dim rsgeneral As ADODB.Recordset
dim numerocontrol as string
numcontrol = InputBox("Introduce el numero de control")
If numcontrol = "" Then
Exit Sub
Else
conexion'aqui es donde llamo mo conexion me imagino que solo tienes que modificar esto y poner tucontrol adodc1
Set rsnumero = New ADODB.Recordset
rsnumero.Open "SELECT *FROM registrardatos", con, adOpenDynamic, adLockReadOnly
rsnumero.Filter = "[numcontrol]='" & numcontrol & "'"
Set rsgeneral = rsnumero
If rsnumero.EOF Then
MsgBox "El Numero" & vbCrLf & "[ " & numcontrol & " ]" & vbCrLf & " no fue localizado.", vbCritical
Exit Sub
Else
Text1 = IIf(IsNull(rsgeneral("nombres")), "Campo sin Registro", Trim(rsgeneral("nombres")))
Text2 = IIf(IsNull(rsgeneral("carrera")), "Campo sin Registro", Trim(rsgeneral("carrera")))
Text3 = IIf(IsNull(rsgeneral("escuela")), "Campo sin Registro", Trim(rsgeneral("escuela")))
Text4 = IIf(IsNull(rsgeneral("direscuela")), "Campo sin Registro", Trim(rsgeneral("direscuela")))
Text5 = IIf(IsNull(rsgeneral("director")), "Campo sin Registro", Trim(rsgeneral("director")))
Text6 = IIf(IsNull(rsgeneral("objetoservicio")), "Campo sin Registro", Trim(rsgeneral("objetoservicio")))
Text7 = IIf(IsNull(rsgeneral("actividades")), "Campo sin Registro", Trim(rsgeneral("actividades")))
Text8 = IIf(IsNull(rsgeneral("dependencia")), "Campo sin Registro", Trim(rsgeneral("dependencia")))
Text9 = IIf(IsNull(rsgeneral("dirdepen")), "Campo sin Registro", Trim(rsgeneral("dirdepen")))
Text10 = IIf(IsNull(rsgeneral("unidadad")), "Campo sin Registro", Trim(rsgeneral("unidadad")))
Text11 = IIf(IsNull(rsgeneral("responsable")), "Campo sin Registro", Trim(rsgeneral("responsable")))
Text12 = IIf(IsNull(rsgeneral("cargoresponsable")), "Campo sin Registro", Trim(rsgeneral("cargoresponsable")))
Text13 = IIf(IsNull(rsgeneral("diasprestacion")), "Campo sin Registro", Trim(rsgeneral("diasprestacion")))
Text14 = IIf(IsNull(rsgeneral("finicio")), "Campo sin Registro", Trim(rsgeneral("finicio")))
Text15 = IIf(IsNull(rsgeneral("ftermino")), "Campo sin Registro", Trim(rsgeneral("ftermino")))
Text16 = IIf(IsNull(rsgeneral("fregistro")), "Campo sin Registro", Trim(rsgeneral("fregistro")))
Text17 = IIf(IsNull(rsgeneral("horario")), "Campo sin Registro", Trim(rsgeneral("horario")))
Text18 = IIf(IsNull(rsgeneral("programa")), "Campo sin Registro", Trim(rsgeneral("programa")))
Text19 = IIf(IsNull(rsgeneral("semestre")), "Campo sin Registro", Trim(rsgeneral("semestre")))
Text20 = IIf(IsNull(rsgeneral("horas")), "Campo sin Registro", Trim(rsgeneral("horas")))
Text21 = IIf(IsNull(rsgeneral("numcontrol")), "Campo sin Registro", Trim(rsgeneral("numcontrol")))
End If
Exit Sub
End If
End Sub |