Hi everyone,
I'm using this piece of code to remove any "zero's" at the start of whatever number a person puts into the text box (Text38), this works great.
I tried to modify it to remove any Spaces as well and although it seems to work, im not sure if the loop is ending as the code screen flickers like its running code. (Only works for spaces at the start of string)
(I used this to remove the space at the beginning of the string but not sure if it's correct even though it seems to work..)
What im trying to achieve is to remove any spaces in the "string" used as a filter to run a search query..
ie if imputed number was.. (00 1234 1234 1) I need to remove the zero's (at the start of the string only) and also any spaces it the whole string.
So above would look like this prior to the filter running. (123412341)
Hope you understand what im after and thanks for looking.
Regards
Nick
I'm using this piece of code to remove any "zero's" at the start of whatever number a person puts into the text box (Text38), this works great.
Code:
Dim RemZero As Integer
For RemZero = 1 To Len(Text38)
If Left(Text38, 1) = "0" Then
Text38 = Right(Text38, Len(Text38) - 1)
End If
Next RemZero
I tried to modify it to remove any Spaces as well and although it seems to work, im not sure if the loop is ending as the code screen flickers like its running code. (Only works for spaces at the start of string)
(I used this to remove the space at the beginning of the string but not sure if it's correct even though it seems to work..)
Code:
Dim RemSpace As Integer
For RemSpace = 1 To Len(Text38)
If Left(Text38, 1) = " " Then
Text38 = Right(Text38, Len(Text38) - 1)
End If
Next RemSpace
What im trying to achieve is to remove any spaces in the "string" used as a filter to run a search query..
ie if imputed number was.. (00 1234 1234 1) I need to remove the zero's (at the start of the string only) and also any spaces it the whole string.
So above would look like this prior to the filter running. (123412341)
Hope you understand what im after and thanks for looking.
Regards
Nick
Last edited: