removing upwanted spaces

mrrayj60

Registered User.
Local time
Today, 13:33
Joined
Sep 3, 2009
Messages
103
My form has this after update code. Well my users are adding spaces in the tag number and makes it difficult to sort. They appear as ABC 123 instead of ABC123.
Any suggestions? Thanks, Ray

Me.License_Tag_Number = Trim(UCase(Me.License_Tag_Number))

Thanks, pbaldy
Private Sub License_Tag_Number_AfterUpdate()
Me.License_Tag_Number = Trim(UCase(Me.License_Tag_Number))
Me.License_Tag_Number = Replace(Me.License_Tag_Number, " ", "")
 
Last edited:
To get rid of spaces in the middle of the string, try the Replace() function.
 
infact, there might be multiple spaces

while instr(1,mystring," ")
mystring = replace(mystring," ","")
wend
 
Code:
?replace("abc 123"," ", "")
abc123
?replace("abc  123"," ", "")
abc123
?replace("abc      123"," ", "")
abc123
 
paul - of course - i was thinking of replacing double spaces with a single space.
 

Users who are viewing this thread

Back
Top Bottom