'En este evento uso dos funciones para validar entradas en longitud y
'tipo de datos y luego paso el foco al siguiente control al pulsar enter
Private Sub text5_KeyPress(KeyAscii As Integer)
KeyAscii = LargoTxt(KeyAscii, Text5.Text, 15)
KeyAscii = SoloNumeros(KeyAscii)
If KeyAscii = 13 Then Text6.SetFocus
End Sub
'Aqui seguidamente te muestro las funciones
Function LargoTxt(ByVal KeyAscii As Integer, texto As String, largo As Integer) As Integer
If Len(texto) = largo And KeyAscii <> 13 And KeyAscii <> 8 Then
LargoTxt = 0
Else
LargoTxt = KeyAscii
End If
End Function
'En esta funcion ves como validar entradas de numeros y otros caracteres
Function SoloNumeros(ByVal KeyAscii As Integer) As Integer
If InStr("0123456789.,+-*/", Chr(KeyAscii)) = 0 Then
SoloNumeros = 0
Else
SoloNumeros = KeyAscii
End If
If KeyAscii = 8 Then SoloNumeros = KeyAscii 'Backspace
If KeyAscii = 13 Then SoloNumeros = KeyAscii 'Enter
End Function