text box on exit

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,
 
F

fredg

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
 
S

Souris

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top