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

Background colour on a crosstab report

Status
Not open for further replies.

RobPotts

Technical User
Aug 5, 2002
232
US
Hi,

I have a report based on the results of a crosstab query, which uses the following code to display the information:
Code:
Private Sub Report_Open(Cancel As Integer)
    ' You didn't know how many columns, or what
    ' their names would be, until now.
    ' Fill in the label captions,
    ' and control ControlSources.
    
    Dim intColCount As Integer
    Dim intControlCount As Integer
    Dim i As Integer
    Dim strName As String
    
    On Error Resume Next
    
    Dim rst As ADODB.Recordset
    
    Set rst = New ADODB.Recordset
    rst.Open _
     Source:=Me.RecordSource, _
     ActiveConnection:=CurrentProject.Connection, _
     Options:=adCmdTable
    
    intColCount = rst.Fields.Count
    intControlCount = Me.Detail.Controls.Count
    
    If intControlCount < intColCount Then
        intColCount = intControlCount
    End If
    
    ' Fill in information for the necessary controls.
    For i = 1 To intColCount
        strName = rst.Fields(i - 1).Name
        Me.Controls("lblHeader" & i).Caption = strName
        Me.Controls("txtData" & i).ControlSource = strName
    
              
    Next i
   
    
    ' Hide the extra controls.
    For i = intColCount + 1 To intControlCount
        Me.Controls("txtData" & i).Visible = False
        Me.Controls("lblHeader" & i).Visible = False
      
       
    Next i
    If Me.txtData1 > 1 Then
    Me.TrainedTitles.Visible = True
    End If
    ' Close the recordset.
    rst.Close
    
    
End Sub

On report open I would like the report to check the conent of the txtData fields and change the colour of that field if it is present (if it contains the word "Yes", this is a text field). Is this possible, if so how do I go about it?

Thanks in advance



Rob! [Bigcheeks]
Process and Procedure are the last hiding place of people without the wit
and wisdom to do their job properly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top