Add text at end of value of textbox (1 Viewer)

guestbb

Registered User.
Local time
Today, 11:40
Joined
Jul 14, 2015
Messages
44
I have a textbox where people insert numbers and what i want is that when they type the number in the textbox at the end it gets a measurement.
Example:
I type 567, after being typed it should show 567 kilos
And when I change the number it would also keep the kilos at the end.
But when i dont insert any value i dont want it to show kilos in the textbox.
People insert only whole numbers, without decimal points.
 

plog

Banishment Pending
Local time
Today, 13:40
Joined
May 11, 2011
Messages
11,676
Why not make it a seperate label just to the right of that input:

[ ] Kilos

You could even have a form load event that blanks out that label if no data is present in the input.

Otherwise its going to take an unbound form and an event after update and onload of the form.
 

James Deckert

Continuing to Learn
Local time
Today, 13:40
Joined
Oct 6, 2005
Messages
189
You could just have an unbound field which moves the data into the hidden bound field, but plog's first suggestion sounds better to me.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:40
Joined
May 7, 2009
Messages
19,249
use Input Mask.

Private Sub Text0_GotFocus()
Me.Text0.InputMask = ""
End Sub

Private Sub Text0_LostFocus()
Dim i As Integer
Dim intLen As Integer
Dim strText As String
Dim strMask As String

strText = "" & Me.Text0
intLen = Len(strText)

If intLen > 0 Then
For i = 1 To intLen
If Mid(strText, i, 1) = "." Then
strMask = strMask & "."
Else
strMask = strMask & "#"
End If
Next
Me.Text0.InputMask = strMask & " \k\i\l\o;0; "

End If

End Sub
 

Users who are viewing this thread

Top Bottom