Alternate row color

RichMorrison

Registered User.
Local time
Today, 03:12
Joined
Apr 24, 2002
Messages
588
*****************
Sorry, never mind this post. Found the right search terms
*****************


Haven't seen this question before.

On a continuous form, can I alternate the back color ?
(Row one is white, row two is grey, row three white, etc.)

Thanks,
RichM
 
Last edited:
I'd like to see that too. Do you still have the link or remember the search term?
Thanks
 
Len,

Think it was something like "alternate color".

Anyway, the bottom line is you can do it with Acc2K but not with earlier versions. Acc2K has "conditional formatting". Since I am using Acc97 I gave up.

RichM
 
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 wrote
<<
You should be able to modify the code to use in a form.
>>

No. If that was true we wouldn't have a bunch of threads on this topic. :)

RichM
 
I think I've managed to reduce the size enough to post here now
 
Last edited:
Rich,

Thanks for sharing. Awesome sample! :D

Where there is a will, there is always a way.
 
Rich,

Thanks. I have been studying your example today. It works fine.

Idle Question:
what is the purpose of the Format in the text box ?

Thanks,
RichM
 
Rich,

I made some modifications to your example of alternating colors in a continuous form.

This sample uses a function that alternately returns 0 or -1 when called; a "toggle" function.

RichM
 

Attachments

Hi

I've used this function (AltColour.zip) to great success on a Win XP pc, but when viewed on a Win 98 pc, the alternate row, instead of being another colour, shows ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ in the background.

Any ideas's why?
 
Last edited:

Users who are viewing this thread

Back
Top Bottom