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

Alternate Line row shading 1

Status
Not open for further replies.

GirlBlonde

Programmer
Oct 30, 2007
94
AU
hi

i have just converted to 2007 and when i am applying the code below to the on print event in the detail section it is no longer working. i am trying to alternate line row shading.

can anyone assist me with why this isnt working? Is it done another way in 2007>

greatly appreciate any help

code;

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
'shade this row or not

Dim fshade As Integer


Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Const COLOR_SHADE = 14676208
Const DS_INVISIBLE = 5

If fshade Then
Me.DrawStyle = DS_INVISIBLE
Me.Line (0, 0)-(Me.Width, Me.Section(0).Height), COLOR_SHADE, BF
End If

'alternate the value of shade
fshade = Not fshade
End Sub

Energy & persistance conquer all things!
 
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Me.Section("Detail").BackColor = Me.Section("Detail").BackColor Xor RGB(32, 32, 32)
End Sub

Notes:

[tab]'All controls have their background set to transparent

[tab]'change the 'degree' of thre shading by varying the value in RGB(...). Increasing the value DARKENS the background, lightens it.

You CAN actually create different colors by not using the same value in all three instances. But to use more than the two colors you need additional logic to determine which to apply.






MichaelRed


 
hi

i added your code to the on print in the detail section but it is not shading alternately consistantly. the first 3 records are not shaded and then it does do for ones after that.

is there something i am missing?

thanks

Energy & persistance conquer all things!
 

GirlBlonde[
AFAIK, it works just like in the code block -everwhere-. I have used this for close to ten years in access reports without noticing the issue you mention (skipping rows). What is worse, I can not even imagine why it would not work universally.

dhookom
Haven't even tried Ms. A. '07, so cannot answer this.




MichaelRed


 
In the property sheet for the section, there are properties 'Back Color' and 'Alternate Back Color'.

Lilliabeth
-Why use a big word when a diminutive one will do?-
 
thanks MichaelRed never knew this quick method
Have A Star
 
thank you very much the quick method worked great

Energy & persistance conquer all things!
 
hi

i have just noticed that the 2007 alternate back colour is not working. it just highlights all the details section?? i have gone into the properties and selected alternate back colour and chosen the colour. i want it to highlight every second row to provide easy reading.

can anyone assist?

many thanks

Energy & persistance conquer all things!
 
and what "method" are you refering to? the code method supplied above or the "built in" properties method mentioned above?



MichaelRed


 
hi

the built in property thats in 2007.

Energy & persistance conquer all things!
 
Still not up to ysing the '07 version, so can't answer. The code snippet provided Jul 9 works well enough.



MichaelRed


 
hi

very frustrated, i have clicked on the detail section, in the properties box for back colour is #FFFFFF and on alternate back colour is #FFF200 not working. back colour on fields is transparent???

help please...

Energy & persistance conquer all things!
 
colour on fields is transparent???" are you asking or telling? The controls in the section must be transparent in order for the changing section background colors to be seen.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top