Hi Michel,
First, let me remind you, in case you forgot, that strings are aligned left and numbers are aligned right. I still think that's a International standard but if anybody could clarify this for us, it would be nice....
Second, text controls have an alignment property; left, center, right, whether on forms or reports.
Third, if you still ignore those 2 first point then I give you the codes below.
Try this...
'on click of a command button, call the function AddSpaceToAlignLeft with a _ string parameter.
Private Sub Command1_Click()
Me!Text1.Text = AddSpaceToAlignLeft(Me!Text1.Text)
End Sub
Public Function AddSpaceToAlignLeft(ByVal StrReceiveValue As String) As String
Dim IntLenght, IntSpaceToAdd As Integer
'Determine the total lenght of the string received
IntLenght = Len(StrReceiveValue)
'Calculate the total space needed. 11 because 8 + "." + 2
IntSpaceToAdd = 11 - IntLenght
'Return the added space and the original string value
AddSpaceToAlignLeft = Space(IntSpaceToAdd) & StrReceiveValue
End Function
Good luck
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only