Unanswered: Checking each record of a continious form
I have a continious form based on a query.
Now I want to check every record and depending on the value change the foregroundcolour.
Example : The form exists of 2 fields. (name, age).
I want the subform displaying every record, but when the person is younger than 20 years, the age should be written in green.
If he's between 20 and 40, the age is written in red.
Else the age is written in blue.
I assume that you wish to use a form to display this data, if so here we go:
Create a blank report using your query as the data source. Now create two (2) text fields on the form. Name them: "Name" and "Age" (Omit the quotation marks). Now right mouse click on the details bar and select the properties option. Click on the Event Tab and select the "On Print" Event. Right Mouse click on the On Print Event Field and the Choose Builder Form will open. Select the Code Builder option. Next the Visual Basic Editor Screen will open. Type or cut and paste the following code in between the Private Sub Heading and Sub End Footer:
Dim Red, Blue, Green
Red = "255"
Blue = "65280"
Green = "16711680"
Select Case Me!Age
Case Is < 20
Me!Name.ForeColor = Green
Me!Age.ForeColor = Green
Case 20 To 40
Me!Name.ForeColor = Red
Me!Age.ForeColor = Red
Me!Name.ForeColor = Blue
Me!Age.ForeColor = Blue
Now you will see that your data will displayed in the manner that you specified
Last edited by Chumpie999typla; 03-17-03 at 08:15.