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!

apply conditional formatting between 2 subreports

Status
Not open for further replies.

Richey

Technical User
Aug 29, 2000
121
GB
Hi

I have a report rptFormA containing 2 subreports

[dbo_tblStratRecords subreport]
which has a field intNewID (primary key)

and
[dbo_tblKeyComponents subreport]
which also has a field intNewID

the [dbo_tblStratRecords subreport] may have 2 records with the intNewID's being 1 and 10 for example.

the [dbo_tblKeyComponents subreport] may have 5 records, three records with an intNewID of 1 and two records with an intNewID of 10 (many-one relationship with the intNewid on [dbo_tblStratRecords subreport] basically)

I'd like the intNewID record of 1 on [dbo_tblStratRecords subreport] to be coloured red (for example) and the intNewID record of 10 to be coloured green. different colours !

then on the [dbo_tblKeyComponents subreport] the three records will be coloured red and the two records will be coloured green.

hope that makes sense !

thanks
kim




 
apply conditional formatting to the sub reports seperately...?

--------------------
Procrastinate Now!
 
Personally I try to avoid the built in Conditional Formatting - it is quite restricted. I think perhaps you should take a look at the 'OnFormat' event of the Detail section in each of the sub-reports. There you could apply the code along the lines of...

Code:
If Me.[MyControl] = 1 Then
Me.[MyControl].ForeColor = vbRed
End If

Any help ?
 
yeah I've given up with conditional formatting....is there any way you can say to move next on the OnFormat detail event procedure, as in move to the next record ?

thanks
 
The OnFormat event is related to the entire detail section, not individual records. So if you had two records in a subreport detail section with values of 1 and 10 and the OnFormat event had code along the lines of

Code:
If Me.intNewID = 1 Then
Me.intNewID.ForeColor = vbRed
Else: Me.application_full_name.ForeColor = vbBlue
End If

The record with a value of 1 would be Red, all other values would be blue. (I can't remember if there is a built in 'vbGreen', but you can substitute this part of the line with the colour code found in the properties of a control)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top