This message was once put in this Access Forum:
____________________________________________
Below is the code from the Microsoft Access 97 "Reports" sample db that alternates the color between rows within a report. You should be able to modify the code to use in a form.
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Const WHITE = 16777215
Const YELLOW = 65535
If (Me![LineNum] Mod 2) = 0 Then
Me![ProductName].BackColor = YELLOW
Me![CategoryName].BackColor = YELLOW
Me![QuantityPerUnit].BackColor = YELLOW
Me![UnitsInStock].BackColor = YELLOW
Else
Me![ProductName].BackColor = WHITE
Me![CategoryName].BackColor = WHITE
Me![QuantityPerUnit].BackColor = WHITE
Me![UnitsInStock].BackColor = WHITE
End If
End Sub
HTH
ghudson
I am using Windows XP with Access 97
____________________________________________
Unfortunately, I could not get this to work. How do I add the text box [LineNum] in the report?
Stefan.
____________________________________________
Below is the code from the Microsoft Access 97 "Reports" sample db that alternates the color between rows within a report. You should be able to modify the code to use in a form.
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Const WHITE = 16777215
Const YELLOW = 65535
If (Me![LineNum] Mod 2) = 0 Then
Me![ProductName].BackColor = YELLOW
Me![CategoryName].BackColor = YELLOW
Me![QuantityPerUnit].BackColor = YELLOW
Me![UnitsInStock].BackColor = YELLOW
Else
Me![ProductName].BackColor = WHITE
Me![CategoryName].BackColor = WHITE
Me![QuantityPerUnit].BackColor = WHITE
Me![UnitsInStock].BackColor = WHITE
End If
End Sub
HTH
ghudson
I am using Windows XP with Access 97
____________________________________________
Unfortunately, I could not get this to work. How do I add the text box [LineNum] in the report?
Stefan.