text box on exit

  • Thread starter Thread starter Souris
  • Start date Start date
S

Souris

I have validate code on text box and want to cursor get back text box.

I use Screen.ActiveControl.SetFocus, but the cusor goes to where my mouse
click.

Are there any way to let cursor stay in the text box until user enter valide
data?


Your help is great appreciated,
 
I have validate code on text box and want to cursor get back text box.

I use Screen.ActiveControl.SetFocus, but the cusor goes to where my mouse
click.

Are there any way to let cursor stay in the text box until user enter valide
data?

Your help is great appreciated,

Use the Text control's BeforeUpdate event to validate the data.

If IsNull(Me.[ControlName]) or Me.[ControlName] = "WrongData" then
MsgBox "Wrong Entry."
Cancel = true
End If
 
thanks millions,


fredg said:
I have validate code on text box and want to cursor get back text box.

I use Screen.ActiveControl.SetFocus, but the cusor goes to where my mouse
click.

Are there any way to let cursor stay in the text box until user enter valide
data?

Your help is great appreciated,

Use the Text control's BeforeUpdate event to validate the data.

If IsNull(Me.[ControlName]) or Me.[ControlName] = "WrongData" then
MsgBox "Wrong Entry."
Cancel = true
End If
 
Back
Top