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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove all text after the first space in a text box 1

Status
Not open for further replies.

Vec

IS-IT--Management
Jan 29, 2002
418
US
I have a text box named txtDate

I need the "lost focus" event of the box to do the following:
Sometimes there may be characters after the date, however there is always a space first for example:
02/03/02 A332
I need the lost focus of the text box to basically remove everything after the space so that just the clean date is left. The characters after the space (if any) will be of varying charcter counts. -
radium.gif

Looking Toward The Future
 
Hi

JohnYingling's code does exactly what you asked for: remove everything
*after* the space, however this leaves the space at the end of your string.

If you want to take that out as well, then modify the code as such:

text1.Text = Left$(tetx1.text,lngInstr - 1)

HTH
Rowland
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top