![]() |
#6
|
|||
|
|||
![]()
Hello Guessed and GMaxey,
I have implemented both of your ideas into my Validation process but am having problems with the focus being returned to my first texbox (txt1) if validation fails. Currently, the focus moves to my second textbox (txt2). I am using the TAB key to advance the cursor from textbox to textbox. Maybe it is the end of the week and I am missing something easy. Here is my code for the Validate procedure I have created: Code:
Sub Validate(ControlNumber As Integer) Select Case ControlNumber Case 1 'number only If Not IsNumeric(txt1.Text) Then MsgBox ("Must be a Number") txt1.SetFocus End If 'Case 2,3,4,5,6,7,8 to follow End Select End Sub Code:
Private Sub txt1_AfterUpdate() txt1.BackColor = vbWhite Validate (1) End Sub How do I get the focus to return to txt1 and keep it there as many times as necessary until user puts in only numbers? Maybe I am using the incorrect event or missing something easy? Thanks |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Generate template-based letter with multiple variables | shallaes | Word VBA | 5 | 07-12-2018 12:18 AM |
Multiple Problems with a loop | Radtastic10 | Excel Programming | 3 | 06-09-2017 09:38 AM |
Testing multiple values of two independant variables and charting results | sgcannon | Excel | 0 | 10-20-2015 10:10 AM |
Array to iterate through variables and trap blank variables | Marrick13 | Word VBA | 5 | 08-04-2015 06:19 AM |
Same values of variables in word add-in are being shared across multiple document | naq.abbas@gmail.com | Word | 0 | 01-13-2014 10:41 AM |