kcolbert01
Registered User.
- Local time
- Today, 06:39
- Joined
- Jan 13, 2003
- Messages
- 36
I have used code to create a horizontal and vertical lines on a report to create a speadsheet like effect. The vertical lines are set according to the width of the text fields across the top of the page (sort of a column like effect) so they never change. The horizontal lines, however, grow with the text box and continues across the page thus creating the spreadsheet like effect that I am looking for. I created the horizontal lines this way (insteat of just putting a line around the text box) because I need the line to go across the page.
The only problem I am having is making the line not be created if the text box has no data. Any thoughts or ideas would be helpful - this problem is driving me mad. I have been trying to outsmart this program for 2 days!!!
Here is the code:
Dim X1 As Single, Y1 As Single
Dim X2 As Single, Y2 As Single
Dim X3 As Single, Y3 As Single
Dim X4 As Single, Y4 As Single
Dim Offset As Single
Dim Color As Long
' Specify unit of measurement for coordinates on a page...
Me.ScaleMode = 1 ' ...in twips (1440 twips = 1 inch).
' Define an offset of 1/8 inch from the text box to the rectangle.
Offset = 1440 / 40
' X and Y coordinates for the top left corner of the box.
X1 = (Me![12a].Left - Offset) * 14400
Y1 = Me![12a].Top - Offset
X3 = (Me![12b].Left - Offset) * 14400
Y3 = Me![12b].Top - Offset
' X and Y coordinates for the bottom right corner of the box.
X2 = (Me![12a].Left + Me![12a].Width + Offset) * 14400
Y2 = Me![12a].Top + Me![12a].Height + Offset
X4 = (Me![12b].Left + Me![12b].Width + Offset) * 14400
Y4 = Me![12b].Top + Me![12b].Height + Offset
Me.DrawWidth = 3 ' Width of the line (in pixels).
Color = RGB(0, 0, 0) ' Use black line color.
' Draw the rectangle with the Line method.
Me.Line (X1, Y1)-(X2, Y2), Color, B
Me.Line (X3, Y3)-(X4, Y4), Color, B
Now I need a way to tell it to NOT draw the line if there is no data.
Thanks in advance for your help!
The only problem I am having is making the line not be created if the text box has no data. Any thoughts or ideas would be helpful - this problem is driving me mad. I have been trying to outsmart this program for 2 days!!!
Here is the code:
Dim X1 As Single, Y1 As Single
Dim X2 As Single, Y2 As Single
Dim X3 As Single, Y3 As Single
Dim X4 As Single, Y4 As Single
Dim Offset As Single
Dim Color As Long
' Specify unit of measurement for coordinates on a page...
Me.ScaleMode = 1 ' ...in twips (1440 twips = 1 inch).
' Define an offset of 1/8 inch from the text box to the rectangle.
Offset = 1440 / 40
' X and Y coordinates for the top left corner of the box.
X1 = (Me![12a].Left - Offset) * 14400
Y1 = Me![12a].Top - Offset
X3 = (Me![12b].Left - Offset) * 14400
Y3 = Me![12b].Top - Offset
' X and Y coordinates for the bottom right corner of the box.
X2 = (Me![12a].Left + Me![12a].Width + Offset) * 14400
Y2 = Me![12a].Top + Me![12a].Height + Offset
X4 = (Me![12b].Left + Me![12b].Width + Offset) * 14400
Y4 = Me![12b].Top + Me![12b].Height + Offset
Me.DrawWidth = 3 ' Width of the line (in pixels).
Color = RGB(0, 0, 0) ' Use black line color.
' Draw the rectangle with the Line method.
Me.Line (X1, Y1)-(X2, Y2), Color, B
Me.Line (X3, Y3)-(X4, Y4), Color, B
Now I need a way to tell it to NOT draw the line if there is no data.
Thanks in advance for your help!