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

Grey out every other line on a report

Status
Not open for further replies.

pdtit

Technical User
Nov 4, 2001
206
BE
Hi,

In the old days, you had this paper for printing out listings from a mainframe where one line was white and the other one green.

Does anyone know how I could arrange this for a report, where the first line is white, second is grey, third is white again and so forth and so forth ??

Regards,

PDTit
 
In my "Old Days", it was "groups of three - which I prefer, but the question has been asked (and answered) many times in the same way you have asked it.

You posted this in the FORMS forum, and referenced dooing it on a FORMS, which is only possible in Ms. A. Ver 2K using Conditional Formatting -NOT- the following, which is for REPORTS, as hinted at by the reference " ... paper for printing ... ".

In the design view of the REPORT, set the BackStyle and the BorderStyle of ALL of the controls in the section (DETAIL) to Transparent.

In the General section of the report CODE module, declare a single variable:

[tab]blnBkFlg as Boolean

In the OnFormat event of the (DETAIL) section,

Toggle the flag:

blnBkFlg = Not blnBkFlg

and Change the BackColor of the (DETAIL) Section

Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

    Dim MyGrey As Long
    MyGrey = RGB(222, 222, 222)

    blnBkFlg = Not blnBkFlg
    If (blnBkFlg = True) Then
        Me.Detail.BackColor = vbWhite
     Else
        Me.Detail.BackColor = MyGrey
    End If

End Sub
MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top