View Full Version : losefocus then setfocus back


eaytjwr
08-28-2002, 02:54 AM
I have a sub that is activated after losing focus from a field: the user scans in a barcode and the scanner automatically tabs forward, running the sub.

I want to end the sub by clearing and setting the focus to the original field, but it won't let me: I presume this is because you can't set the focus in a sub that loses the focus.

Is there a 'nice' way to do this? Maybe activate the sub differently?

Ta
eaytjwr

ghudson
08-28-2002, 06:02 AM
At the end of your sub, you should be able to set the focus to any text box and then reset it's value.

Me.TextBox1.SetFocus
Me.TextBox1.Value = Null

But do you need to move to a new record so that you do not remove what was just scanned in the current record?

DoCmd.RunCommand acCmdRecordsGoToNew

HTH