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

Positioning Labels/Textboxes on a report 1

Status
Not open for further replies.

lind77

Technical User
Oct 17, 2003
14
NL
Hi,

i have designed a report that draws horizontal lines based on arrival date and type and whose length is function of duration (in days and hours). I have done this by converting the times into x-coordinates and types into y-coordinates. This allows me to plot the horizontal lines for specific occurences.

However, I would like to attach labels to each line, stating for example the ETA and name but I just can't get my head around it. I have tried changing them to text boxes but also to no avail. Ideally, each line should have 3 labels (one at either end below and one centered above the line). So this is a dual problem:

i. how can I create three labels for each line without having to manually create each single one and;

ii. how can I position them on the report as mentioned above? (ie how can I give the label coordinates on a report?)

I hope someone out there can help me, and if that's you ,please do!

Thanks,

Mark
 
Mark, it sounds like something that needs to be done through Visual Basic for Applications. You would need to use the Left, Top, Width, and Highth properties for the coordinates.
 
Yes, I have gotten that far but I can't get these properties to work for labels or text boxes even though I know they should.

For example: Label401.Left = x1 + 100 (for a calculated value of x1)yields a run time error: 2101 The setting you entered isn't valid for this property.

I get this for both labels and unbound text boxes (I just need it to display a value).

When I have mastered this I will still need a way to generate labels for each line.

Cheers,

Mark
 
Mark,
You didn't state the method you are using to draw the horizontal lines. Are you using the line method? If so, you can use similar code with the Print method. The Corp Tech Demos at has several sample reports that draw lines and add text in specific coordinates on the report page.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Hi Duane,

Thanks for your tip, I am looking to see how I can adjust the 'Calendar' sample to suit my purposes. However, I have drawn the lines another way.

I have created a standard A4 report on which the lines are drawn based on calculated coordinates. These coordinates are a function of time of arrival, time of departure and type. these values were then put into a Me.Line Step(x1,y1) - Step (x2,y2) function. This is done not by using controls but a DLookup function within a loop. It was my aim to create labels at either end of the line stating time of arrival and departure, within the loop.

This is roughly what I want:

date
type -----------
eta dep

all concurrent on the same page, with each type occurring more than once and therefore on the same 'height'. I can't get the *.left or *.top functions to work, it keeps telling me 'the setting is incorrect for this property', but I can't see why.

If you like I could post the code so you can see what I am trying to do. Well, I hope this method works, otherwise it's a whole week out the window!

Thanks

Mark
 
I would need to see some of the code where you are attempting to set the left and top properties. You should be able to set these properties of controls during the on Format or On Page events.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Hi Duane,

I realized I was going about it the wrong way - i was plotting lines between two coordinate points. Using the examples you suggested I have altered the code as follows:

Me.CurrentX = 40
Me.CurrentY = 25


If DEP.Value < ARR.Value Then
DEP = 7 + DEP
End If

x21 = DateDiff(&quot;n&quot;, Me.ETA, Me.ETR)
x1 = 30 * ((ARR - 1) + ETA) - 1.25
x2 = 30 * (x21 + (DEP - ARR))
y1 = 10 * (AC1 - 1)

Me.MoveLayout = False
Me.Info.Left = 100 * x1
Me.Info.Width = 100 * x2
Me.Info.Top = 100 * y1

However I still get either the 'incorrect stting for property error' or the text box is placed at a fixed position on the page. For an easy comparison, I am trying to create a report similar to the rotation report you pointed out to me.

Why doesn't this work??

Thanks,

Mark
 
1) Can you tell me which line of code causes the error?
2) Do know how to use debug.print so that you can view the values of variables?
3) Are you using the default scale mode (twips)?
4) What type of values are stored in ETA, ETR, DEP, ARR, AC1?
5) Is Info a text box?

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
In answer to your questions:

1.The only lines of code causing errors are the positioning lines (.left , .width, .top). i get error 2101: the setting you have entered is incorrect for this property.
2. The values of the variables are calculated correctly, there are no excessively larg or infinite numbers, mostly they are less than 100
3. I had set my scalemode to 6 so that I could define measurements in mm, I have chnaged this to see if this had any effect but alas.
4.ETA and ETR store times, DEP and ARR values from the weekday function, AC1 is a number
5. Info is a text box.

I had this whole thing up and running using the Me.Line Step (x1,y1)-Step(x2,y2) function. However, because this did not allow me to include infomation with the lines I decided to attempt to do it your way.

Mark
 
I expect that your code might be in the On Print event. You can't move stuff in the On Print event. You can use the On Print event to draw lines and print on the report.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
It was, but when I moved to the Format event the same happened, or didn't actually haha.
 
I can't see your face... Are you pulling my leg or did you actually get this working now?

Look back to my posting about a week ago and you will find &quot;You should be able to set these properties of controls during the [Blue] on Format or On Page events [/blue].&quot;
DuaneHookom.jpg


Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Hi Duane,

I got it all to work!After another day banging my head against the Access wall i have finished it in time for the weekend! thanks for your help. (Iwasn't pulling your leg, but I had copied from onprint to format with deleting it)

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top