RE:TextBox y ADO, continuacion parte 2
continuacion:
Sub Errores()
Msg = "Error Ocasionado Por:" + Chr(13) + Err.Description
MsgBox Msg, vbCritical, "Error" + Str(Err.Number)
Err.Clear
End Sub
Sub Registro()
If Rec.State = adStateOpen Then Rec.Close
Rec.CursorLocation = adUseClient
Rec.CursorType = adOpenDynamic
Rec.LockType = adLockOptimistic
End Sub
'Capturas el Numero
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
sql = "Select * From Tabla1 Where Campo1= " & Text1
Registro
Rec.Open sql, cnbase
If Rec.RecordCount > 0 Then
Text1 = Rec!Campo1
Text2 = Rec!Campo2
Else
MsgBox "Dato No Encontrado", vbInformation
Text1 = "": Text2 = ""
Text1.SetFocus
End If
End If
End Sub