SmallFishBigPond
New Member
- Joined
- Jul 11, 2012
- Messages
- 3
Please help! Somehow I have become the expert at VBA in my office, which is scary!
I am setting up a simple Userform that will involve a tethered scanner, but no keyboard or mouse (limited input interface). It scans 5 barcodes into each text field and then places the data into an excel sheet before clearing all fields and starting again.
Problem; Clearing all entered data inside any all textboxes and then returning the cursor focus to textbox1 plus resuming the original tab sequence.
Reason; TabOrder (Default Tab Priorety settings) has been set to cycle through each textboxes in a default order. When inside a particular textbox, the clear all barcode is scanned but because the taborder is preset, any attempt to SetFocus back to Textbox1 is overriden by the default TabOrder when the Update event is completed.
Private Sub TextBox1_AfterUpdate()
'Code
'Taborder auto goes to TextBox2
End Sub
Private Sub TextBox2_AfterUpdate()
'Code
End Sub
Private Sub TextBox3_AfterUpdate()
'Clear All Data
If TextBox3.Value = "0001508070;001;0010-0-99" Then 'Barcode ID to indicate clear and return to TBox1
UserForm1.ClearAll
'??????
TextBox3.SetFocus
TextBox3.TabKeyBehavior = False
TextBox3.TabStop = False
TextBox1.SetFocus
'??????
End If
'???????
TextBox3.SetFocus
TextBox3.TabKeyBehavior = False
TextBox3.TabStop = False
TextBox1.SetFocus
'????????
'Exiting the Sub resumes default TabOrder
End Sub
Private Sub TextBox4_AfterUpdate()
'Default Cursor location Assuming TBox 3 command was not to clear
End Sub
I am setting up a simple Userform that will involve a tethered scanner, but no keyboard or mouse (limited input interface). It scans 5 barcodes into each text field and then places the data into an excel sheet before clearing all fields and starting again.
Problem; Clearing all entered data inside any all textboxes and then returning the cursor focus to textbox1 plus resuming the original tab sequence.
Reason; TabOrder (Default Tab Priorety settings) has been set to cycle through each textboxes in a default order. When inside a particular textbox, the clear all barcode is scanned but because the taborder is preset, any attempt to SetFocus back to Textbox1 is overriden by the default TabOrder when the Update event is completed.
Private Sub TextBox1_AfterUpdate()
'Code
'Taborder auto goes to TextBox2
End Sub
Private Sub TextBox2_AfterUpdate()
'Code
End Sub
Private Sub TextBox3_AfterUpdate()
'Clear All Data
If TextBox3.Value = "0001508070;001;0010-0-99" Then 'Barcode ID to indicate clear and return to TBox1
UserForm1.ClearAll
'??????
TextBox3.SetFocus
TextBox3.TabKeyBehavior = False
TextBox3.TabStop = False
TextBox1.SetFocus
'??????
End If
'???????
TextBox3.SetFocus
TextBox3.TabKeyBehavior = False
TextBox3.TabStop = False
TextBox1.SetFocus
'????????
'Exiting the Sub resumes default TabOrder
End Sub
Private Sub TextBox4_AfterUpdate()
'Default Cursor location Assuming TBox 3 command was not to clear
End Sub