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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A97 - Dot leaders between fields in a report

Status
Not open for further replies.

RonMcIntire

Technical User
Oct 12, 2002
166
US
I have a need to put dot leaders between fields in a report but I'm not sure I know how. Here's an example:

Year. . . Season . . . .City/ST . . . . . . .Month/Day

I suspect I will have do it with an involved expression in a query, a macro or an elaborate VBA Code segment.

Can anyone help?

Ron
 
The easiest way I can think of to do this is using Labels between the textboxes. It might help to align the textboxes left and right inorder to get the appearance you want but it shouldn't be very hard.

Paul
 
Paul: Thanks for your response. The problem is that the fields may be of variable length so the dots won't start at the end of the word every time.
I suspect I'll have to write some code in a query that looks like this:

Year& func(".", {tab length}-length(season)-length(year)) etc.

What is the function call for printing a character X number of times?

Ron
 
I thought about this during dinner and realized that answer probably wasn't going to work but here's one I tried that seems to work pretty we.....ll[wink]
Instead of using the label, put some unbound textboxes inbetween your other textboxes and set the Control Source to
="..........................................."

Set the Text Align for all your textboxes to Center, the Can Shrink and Can Grow properties for all your textboxes to Yes and then overlap the information textboxes with the ones holding the dots a little on each side. You may have to play with it a little but I got it to work pretty well. You can set the Font weight for the dots to something heavier if you don't like the look.

Post back if you have any problems.

Paul
 
Paul:

This method works fine. However, a variation is to put all the bound field text boxes over one long unbound ="......." text box. The problem here is that the dots show through (no surprise). To fix that I changed the background color to white, to block the dots. Problem is that the fields vary so much in length that the bound field must be long which leaves long spaces with no dots. Note too, thst the Can Grow and Can Shrink property must be set to NO else multiple lines of dots can result.

Any way you know of to make the field grow and shrink to the exact length of the field? Then the bound field background can be white and effectively block just the right number of dots.

My understanding is that the Can Grow and Can Shrink properties relate to the vertical height of the text box but not the length?

Ron
 
Well I had thought you might be able to use VBA to set the left property for the line but it becomes a huge undertaking. First you have to decide if you are using twips or inches and set all the values to the same scale. Then you need to find out what type of Font you are using and what the scale of that is and convert that value to twips or inches. Twips would be more accurate. To start you would set the Text Align property for your Bound Textbox to Left, say at 1240 twips. Then you would have to return the length of your string in the textbox using the Len() function and convert that to twips, add it to the 1240 and set the Left property for you unbound "....." textbox to that calculated value, are we dizzy yet, and then calculate the left edge of your next textbox and set the Length of the unbound "....." to meet that, and so on and so on.

I got as far as setting the 1st textbox at 1240 twips, but haven't been able to convert the font to twips. You might have to fudge it by guessing
Me.UnboundTextbox.Left = 1240 + Len(BoundTextbox) * 240)
and then adjust the 240 to whatever seems to be the length of one character. Are you still awake. I'll look at it some more but that's where I've gotten to so far.

Paul
 
If you did this with a monospaced font you could very easily accomplish this using simple math and a known field length. IE: I have a table contents report with a variable length chapter name and then the page number at the end. I separate the chapter name from the page number with period's. So for the data fields I chose I made the decision to make all the characters (Chapter+"."+Page Number) equal 70 Characters. Now for the expression (which I put in a query, you can do it in a control if you like:

TOC: [Descr] & String(70-Len([Descr])-Len([PageNbr]),".") & [PageNbr]

So what that does is take the description, concatenate "." using 70-LengthDescription-LengthPageNbr as the number of "."'s to place. Then tack on the PageNbr at the end. So with something like this you could use math and the len function to place your fields wherever you needed. Just set the start character position for each field that you want and use that start character position as your equation starting point to calculate how many "."'s you need.

HTH Joe Miller
joe.miller@flotech.net
 
Ron,

Here's a thread from almost a year ago...It's similar to Joe's post above:

thread703-156837
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top