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

BackColor for text box 1

Status
Not open for further replies.

THWatson

Technical User
Apr 25, 2000
2,601
CA
Using Access 2000

The following code is used to draw lines horizontally and vertically on a report, in order to emulate an Excel spreadsheet.
Code:
Private Sub Report_Page()
Dim intI As Integer
Dim intJ As Integer
Dim intHeight As Integer
Dim intTop As Integer
Dim intLeft As Integer
Dim intWidth As Integer
intHeight = Me.Detail.Height
For intJ = 3 To 31
    For intI = 1 To 9
    intLeft = Me("text" & intI).Left
    intTop = intJ * intHeight
    intWidth = Me("text" & intI).Width
    Me.Line (intLeft, intTop)-Step(intWidth, intHeight), , B
    
    Next
Next
   
End Sub

There are 5 text boxes, numbered text1 through text9 (intI)

What I want to do is have text5 have a light gray back color. And it does so for all of the rows which have data. However, in most cases a number of rows, up to the last row which is 31, will not have data. In those cases, the back color does not fill in.

I have tried inserting the following line in the code
Me.Text5.BackColor = 12632256
but this has no effect.

Is there a way to get that text5 to fill in always? It acts as a divider between the columns of data.

Thanks.

Tom
 
How about:

Code:
For intJ = 3 To 31
    intLeft = Me.Text5.Left
    intTop = intJ * intHeight
    intWidth = Me.Text5.Width
    Me.Line (intLeft, intTop)-Step(intWidth, intHeight), 14737632, BF
    
Next
For intJ = 3 To 31
    For intI = 1 To 9
    intLeft = Me("text" & intI).Left
    intTop = intJ * intHeight
    intWidth = Me("text" & intI).Width
    Me.Line (intLeft, intTop)-Step(intWidth, intHeight), 0, B
    
    Next
Next
 
Remou
Perfect!!!!

As they say, "handy as a pocket in a shirt!"

Thanks.

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top