閉じる

1行ごとに色を変える。


Option Compare Database

Option Explicit

'--------------------------------------------------------------

'  レポートで1行ごとに色を変える。

' 1.クラスモジュールの先頭に、切替変数を記述

'--------------------------------------------------------------

Dim intBWLine As String



'--------------------------------------------------------------

'  レポートで1行ごとに色を変える。

' 2.ページヘッダーで切替変数を初期化

'--------------------------------------------------------------

Private Sub ページヘッダーセクション_Format(Cancel As Integer, FormatCount As Integer)



    intBWLine = "white"



End Sub



'--------------------------------------------------------------

'  レポートで1行ごとに色を変える。

' 3.詳細のフォーマット時のイベントで .BackColor に設定

'--------------------------------------------------------------



Private Sub 詳細_Format(Cancel As Integer, FormatCount As Integer)



    If intBWLine = "white" Then

        Me.Section(0).BackColor = vbWhite

        intBWLine = "Cyan"

    Else

        Me.Section(0).BackColor = vbCyan

        intBWLine = "white"

    End If



End Sub