Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to force right justification on part of a line?

Status
Not open for further replies.

keiserc

Technical User
Feb 24, 2004
16
US
I'm printing a simple label
[Lname] & "," & " " & [Fname] which needs to be LEFT justified.
then I need to follow it - on the same line with two additional fields - which need to be RIGHT justified,to
the end of the label. space between the two sets of fields will vary on length of name. two right fields
[job #] & " " & [Salesman initials] ARE always
6 digits followed by 4 digits which might allow a hard placement. but HOW do I do it? thanks in advance.
 
Using the len function you should be able to determine the total length of your string (fields and spaces combined). From this, you can insert the number of additional spaces required. For example, suppose the len(lname) = 7 and len(fname) = 5. Including the comma and space gives a total of 14 characters. Since the ending is 11 characters (6 + space + 4), your total string length is 25. Subtract this from the total length you want for the label... such as 35 - 25 = 10, which is the number of spaces to be inserted in front of the job number.

Seems like too much work. I'd just use 2 labels.


Randy
 
Just write a public function in a module and send the two sets of text to the function with a return variable of the line as you describe it. If you need the code for such a function, ask and I will code it for you.

Rollie E
 
Be sure to use a fixed font (not a proportional one).

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top