Diving_Dan
Board Regular
- Joined
- Oct 20, 2019
- Messages
- 161
Hi all,
I'm having an issue with setting the focus onto a textbox ("txtOrderNumber") on a userform. This is the code I've got at the moment.
I am entering the order number into the textbox with a barcode scanner. The code all works fine so I click on my barcode with the scanner it finds what I want, puts the values into the sheet and clears the box but it then sets the focus on a command button to close the form instead of setting the focus onto the textbox.
Any help is appreciated as alwways.
Dan
I'm having an issue with setting the focus onto a textbox ("txtOrderNumber") on a userform. This is the code I've got at the moment.
VBA Code:
Private Sub txtOrderNumber_AfterUpdate()
Cells.Find(what:=txtOrderNumber.Value, LookIn:=xlValues).Activate
ActiveCell.Offset(, 5).Value = "Y"
ActiveCell.Offset(, 6).Value = Format(Date, "dd/mmm/yyyy")
Me.txtOrderNumber.Value = ""
Me.txtOrderNumber.SetFocus
End Sub
I am entering the order number into the textbox with a barcode scanner. The code all works fine so I click on my barcode with the scanner it finds what I want, puts the values into the sheet and clears the box but it then sets the focus on a command button to close the form instead of setting the focus onto the textbox.
Any help is appreciated as alwways.
Dan