Set focus

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

how do i set focus on a text box, and keep the set focus on that particular
text box until user enters the correct data. for example i have a text box
that i want the user to only enter letters (no numbers). i want a message
displayed if numerics are entered and for focus to remain until correct data
entered.
 
On the OnKeyDown Property of the field you can enter the code
Private Sub FieldName_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode >= 48 And KeyCode <= 57 Then
MsgBox "Can't enter numbers"
KeyCode = 0
End If
End Sub
'So the user wont have the ability to insert numbers
 
Derrick

How do you feel when an application you're using tells you that you didn't
enter something correctly?

How would you feel if an application gave you only correct choices?

If you provide a bit more description of what kind of data will be entered,
the 'group readers may be able to offer a more user-friendly solution...

Regards

Jeff Boyce
<Office/Access MVP>
 
thanks for the assistance. Its a text box that accepts a person's name. i
therefore do not want any numbers; only letters. furthermore i want the focus
to remain in the text box until the coreect datat is enterd.
 
Too much validation for my liking.
derrick said:
thanks for the assistance. Its a text box that accepts a person's name. i
therefore do not want any numbers; only letters. furthermore i want the focus
to remain in the text box until the coreect datat is enterd.
 
Derrick

Are the names "known"? That is, are you having the user look for persons
already in your database? If so, another approach would be to give the user
a list of the people who ARE in the database, so they can select the correct
one, rather than have to enter the name correctly.

Regards

Jeff Boyce
<Office/Access MVP>
 

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

Similar Threads

Excel Excel 2013 cell text hidden whilst typing 5
Set Focus 2
Setting the focus after data entry 5
Required if Other is used in CboBox 3
set focus 1
Setting the Record Focus... 1
get focus on a field in a form 4
Textbox 1

Back
Top