remove character from text

S

Simon

What would the VB code be to
if i type the following text into txtbox1 'GHY1048573850001' i when i
exit it i would like it to remove the first 3 character and last 4
character and dispay it it in txtBox2

So the text will look like '104857385'


Thanks
 
K

Ken Sheridan

Try this as the ControlSource of txtBox2:

=Mid([txtbox1],4,Len([txtbox1])-7)

The Mid argument returns a substring from the value of its first argument,
starting at the position of its second argument and the length of its third
augment. In this case the third argument gets the length by subtracting 7
(4+3) from the full length of the string as returned by the Len function.

Ken Sheridan
Stafford, England
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top