Private Sub Form_Load()
Dim ctl As Control
Me.姓名.Tag = "3"
Me.性别.Tag = "1"
Me.年龄.Tag = "2"
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
ctl.OnChange = "=AllChange()"
End If
Next ctl
End Sub
Function AllChange()
Dim ctl As Control
Me.Recalc
Me.ActiveControl.SelStart = Len(Nz(Me.ActiveControl.Value, "0"))
If Len(Me.ActiveControl.Value) = CLng(Me.ActiveControl.Tag) Then
SendKeys "{ENTER}"
End If
End Function