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
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement