Tab Order, SetFocus, Limited Usr Interface

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
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top