get rid of spaces and blanks

R

rocco

Hello,
I have posted this question in the wrong section...so here it is again.

I have a texbox on a form. This text box will stores numbers with a
maximum of 2 digit.
I have created this input mask "999.99;0;_"
But it my happens that user can digit only two of the three integers
available . I mean, it can be entered either 123.45 or 12.34
In this second case, I would like that once the textbox loose the focus, the
value showed will be 123.5 and 12_.3 (I'm putting the _ to make things
*clear*).
I would like to see NO spaces or blanks, wherever they are!

thanks
 
R

Rick B

Huh?

Is this a numeric field? If so, it will display what they enter as a
number. There will not be any spaces.

If this is set as a TEXT field, then you need to change it.
 
G

Gina

rocco,
I would like to see NO spaces or blanks, wherever they are!
.....

maybe you're looking for sth. like this

call it on the lostfocus event and put the value of your textbox as argument

HTH,
Gina

****
Public Function fStringValid(ByVal strInString As String) As String
Dim lngLen As Long, strOut As String
Dim i As Long, strTmp As String

lngLen = Len(strInString)
strOut = ""

For i = 1 To lngLen
strTmp = Mid(strInString, i, 1)
Select Case Asc(strTmp)
Case 48 To 57
strOut = strOut & strTmp 'numbers
Case 65 To 90
strOut = strOut & strTmp 'big letters
Case 97 To 122
strOut = strOut & UCase(strTmp) 'small letters
End Select
Next
fStringValid = strOut

End Function
***
 

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