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!

Drawing a Line

Status
Not open for further replies.

pbrown2

Technical User
Jun 23, 2003
322
US
The below code was used to "Shade" a column in a report by drawing an extremly wide line. When used in other reports Y12 has been set to 22 (Simply because it is unpratical at this point for a single item to continue for that long, therefore I know the shading will cover the entire detail). However, now that I would like to change this so that it can be used in the footer, it needs to be changed to approx .25 inches, empty space between the group footer and the next group header. That is the problem.

Can anyone explain why the line appears to start to \/ towards the bottom when the length is shortened? Why won't it simply stop flat at the bottom? Any suggestions?


Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
Dim X11 As Single, Y11 As Single
Dim X12 As Single, Y12 As Single


Dim Color1 As Long

' Specify unit of measurement for coordinates on a page...
Me.ScaleMode = 5 ' Specify that measurement occur in inches.

' Set line to print 3.23 inches from the left margin.
X11 = 3.23
X12 = 3.23



' Set line to print from the top of the detail section
' to a maximum height of .25 inches.
Y11 = 0
Y12 = 0.25

Me.DrawWidth = 360


Color1 = 12632256

' Draw the line with the Line method.
Me.Line (X11, Y11)-(X12, Y12), Color1
End Sub




Thank you for any and all help,

PBrown
 
Use the line method but draw a filled box with it. Keep the drawwidth small.

Duane
MS Access MVP
 
Why do you do it this way? If the entire column (Field) is 'shaded', the backcolor property of the control should do it more easily

MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
As for keeping the line small, are you suggesting I put in multiple "small" lines?

Then as for simply using the BackColor,
I can not simply backcolor the field with the color because the detail width varies since the field [Desc] is set to can grow to make sure the entire field is shown. If the Backcolor is used it will not make a continueous shade of the column, it breaks.
(I.E.)Y1sum is the column that needs to be shaded (All Ysum's have dollar amounts, Y1Sum amounts left off to show shading if backcolor only used)
Item Description Y1Sum Y2Sum Y3Sum
1 kljlkfjalkfjlkajfl shaded 1000 5000
dlfkjalfjafja;ljak;l no shade
jklfjalkfjlajfla;jf no shade
dlkajflkajklfjalkfjlkdaj no shade
2 jflkajflkjalkfj Shaded 2500 7500
jkflajlfjalfjlakjlk no shade
3 jfklajflkajflkajlkfjl Shaded 500 0
klfjalkfjal no shade
4 ffkafkljaklfjlkafjkla Shaded 1500
5 kjjaklfjakldfjklajfklj Shaded 25 222
6 jfkljalkfjalkfjlakjflkja Shaded 999 2588
jkdlajlfkjalkfjalkfj no shade
fkjalkfjalkjflajlfjal no shade

Unless there is away to have [Y1Sum]'s width = the width of [Desc]?
The above is an example of when there is a large grouping, and the line works. However what I need to do is sort and group differently and need to have a group footer that as shadding of only .25
Any suggestions?

Thank you for any and all help,

PBrown
 
You can use the Line method to draw rectangles. The following (if scale is inches) will draw a rectangle 1" from the left and 1" from the top. The size is 2" by 3". The BF creates the rectangle and fills it. YOu can set fill colors and other properties.

lngLeft = 1
lngTop = 1
lngWidth = 2
lngHeight = 3
Me.Line (lngLeft, lngTop)-Step _
(lngWidth, lngHeight), , BF


Duane
MS Access MVP
 
I took the provided code and pasted it "as is" in the On Format of the group footer. However, errors of Variable not defined appears and goes to the begining of the code. What did I miss?

Thank you for any and all help,

PBrown
 
I hadn't dimmed the variables assuming that you would add the lines:
Dim lngLeft as Long
Dim lngRight as Long
Dim lngWidth as Long
Dim lngHeight as Long
My original code used a scale mode of twips which is why I used long.
You will need to change the values to meet your needs.

Duane
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top