Auto Tab when the value of a text is scanned into textbox and/or entered manually

Pookiemeister

Well-known Member
Joined
Jan 6, 2012
Messages
563
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
USERFORM TEXTBOXES
EmpBadgeID
(Tab Index=0)
(Auto Tab = Yes)
(Enabled = Yes)
(Locked = No)

EmpFulName
(Tab Index=1)
(Auto Tab = Yes)
(Enabled = No)
(Locked = Yes)

Item
(Tab Index=2)
(Auto Tab = Yes)
(Enabled = Yes)
(Locked = No)

On my userform, I have three textboxes, how would I auto tab from EmpBadgeID to Item. Basically skip over EmpFullName. The problem that arises is when a badgeID is scanned instead of manually entered. When manually entered, what I am wanting to do, works but not when they scan they their badge ID. The total number of digits entered has to be eight. No more, no less. So I need to look at EmpBadgeID length and if it equals eight then tab to Item? Is this possible? I had even changed the Tab Index so that Item is set to 1 and EmpFullName is set to 2. Here is what I have so far and it does not work. Thank you.

VBA Code:
Private Sub EmpBadgeID_AfterUpdate()
   If Len(Me.EmpBadgeID.Value) = 8 Then Me.Item.SetFocus
End Sub
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi,
You should test the TextBox1_KeyPress event instead of Change or AfterUpdate.
 
Upvote 0
Will that work when a user scans their badge rather than entering it in, because there are no keystrokes when they scan their badge number. Thanks for the quick reply.
 
Upvote 0
At least ... it is worth a try ... since keypress works with ASCII and scan does simulate keyboard inputs ... ;)

Do not know the result since have not tested it myself ... Do not hesitate to share your feedback ...
 
Upvote 0
I think the solution often given is to set the Enter key property (File>Options>Client Settings) to go to the next field. Not sure, have never used a scan gun. Or take the control right out of the tab order: Property Sheet> Other tab > Tab Stop > No
 
Upvote 0
Will that work when a user scans their badge rather than entering it in, because there are no keystrokes when they scan their badge number. Thanks for the quick reply.
I believe the scanner can be set up with a termination character. You choose what it is?
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,380
Members
449,080
Latest member
Armadillos

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