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!

Alternate Shading 2

Status
Not open for further replies.

MBall2003

Programmer
May 30, 2003
61
US
In a report, How can I alternately shade the detail section from white to gray. Any help would be appreciated thanks
 
mball,
try
thread68-556690
should be what you are looking for.
If you try the search box on this forum it will give you some great answers. I found this thread by entering "Shading"
jim
 
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

    'Michael Red.   2/13/2002.      To 'Toggle the backolor, which
    'Provides alternate line shading
    Const XorToggle = 4144959

    Me.Detail.BackColor = Me.Detail.BackColor Xor XorToggle



End Sub

MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Michael,

Is there a way to shade the text to match the back ground also? I ask because I have conditional formatting on some text boxes so they don't show if the value is zero (i.e. print the same color as the background). If I change the background color the 0's show.

I have tried the "ForeColor" and tried to find FontColor but am having no luck.

Thanks in advance for your help.
 
a less difficult soloution would be to set the control's visible property to true / false based on the condition.



MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
I tried something like

Code:
 If Me.Detail.Backcolor = XorToggle Then
     If Me.TEXT1 = 0 Then
          Me.TEXT1 ??? 
      End If
End If

I want to replace the question marks with something to make the 0 value fields not visible, but TEXT1.Visible = False doesn't appear to be an option.

Or would a Select Case statement be better?

Thanks for your help so far.
 
What is XorToggle?

Does your routine ever even get to the second if?




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
XorToggle is the constant that was established earlier in the code you wrote. It is the color.

----
A program is a spell cast over a computer, turning input into error messages.
 
A.[tab]Its "declaration' is not evident in your snippet,

B.[tab] In My procedure, it is declared as a constant. and used in the expression as a MASK to alter the value of the property. You are using it simply as THE value to set the property. What I MEANT was ~~~

Code:
     If Me.TEXT1 = 0 Then
          Me.TEXT1.Visible = False
       Else
          Me.TEXT1.Visible = True
      End If

the POINT of the approach I used for hte ALTERNATE shading was the avoidance if the conditional. In simply doing the alternate, there is no need for the conditional, as every occurance should perform the action. In your case, you want to make the change based on a variable (the 'content of Me.Text1), so testing (the conditional) is necessary, so the 'calculation' of the change becomes irrelevant and hte simple conditional setting is just as efficient / effective. Wheather you use the .Visible propertry or the .Forecolor property is not important (although the value will need to be different).




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Michael,

1st, sorry for the confusion. I should have included all the code, not just a snippet.

2nd, works perfectly. Thanks for you time and help with this. I also appreciate the explanation with the sample code. It makes learning this that much easier.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top