SelStart/Length textbox after update.

flect

Registered User.
Local time
Tomorrow, 09:54
Joined
Feb 26, 2008
Messages
86
Hello world

I've just acquired a barcode scanner to use with my database

I'm now at the point of programming the form

Everything is working correctly except for one feature

I need everything in my barcode textbox to be selected (or deleted) after it has been updated.

frmBarcode.png


It's basically so that I don't have to press the keyboard or mouse after scanning a barcode and can scan the next code if needed.

The scanner is programmed to add [enter key] after a successful scan so it enters the record and triggers AfterUpdate event.

Code:
Private Sub txtBarcode_AfterUpdate()
On Error Resume Next
Me.Form.Requery
Me.Form.Refresh
Dim Cformat As String
Cformat = DLookup("currencyformat", "tblagency", "agencyID = [forms]![frmbarcodesubform]![txtAgentID]")
Price.Format = Cformat

   Me.txtBarcode.SetFocus
   Me.txtBarcode.SelStart = 0
   Me.txtBarcode.SelLength = Len(Me.txtBarcode.Text)
End Sub
doesn't work - but i the have SelStart/Length working ok with a MouseUp event.

should
Code:
 Me.txtBarcode.SelStart = 0
   Me.txtBarcode.SelLength = Len(Me.txtBarcode.Text)
go somewhere else instead?, or should i try a different approach?
 
Have you tried:

Me.txtBarcode = Null

or

Me.txtBarcode = vbNullString
 
Have you tried:

Me.txtBarcode = Null

or

Me.txtBarcode = vbNullString


No, I hadn't tried either - but they work fantastically!!!

Cheers!


:D
 

Users who are viewing this thread

Back
Top Bottom