Hi,
I have a report based on the results of a crosstab query, which uses the following code to display the information:
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.
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.