Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove leading 4 characters when entered into textbox 1

Status
Not open for further replies.

GooGoocluster

Technical User
May 12, 2005
71
US
I found this already but cant figure out how to use it.

I need a textbox to strip the first 4 chars. when text is entered.

The problem is that I am scanning a barcode that its value is "ABCD1234" I need it to store only "1234" when entered into the textbox.
 
In the BeforeUpdate event procedure of the TextBox:
If Trim(Me![textbox name] & "") <> "" And Not IsNumeric(Me![textbox name]) Then
Me![textbox name] = Mid(Me![textbox name], 5)
End If

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
its saying runtime error "fuction on before update property preventing access from saving the data in the field.

Debuger has problem with this line

Private Sub Text0_BeforeUpdate(Cancel As Integer)
If Trim(Me![Text0] & "") <> "" And Not IsNumeric(Me! [Text0]) Then
---> Me![Text0] = Mid(Me![Text0], 5)
End If
End Sub
 
OOps, sorry, I meant the AfterUpdate event procedure of the TextBox.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top