Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2002

    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.

    Can anyone tell me how to do so ?


  2. #2
    Join Date
    Aug 2002
    Northampton, England
    There is an article on the Microsoft Knowledge base that shows how to do this very thing.;en-us;193207


  3. #3
    Join Date
    Dec 2002
    Glasgow, UK
    If you are using Access 2000 or Access XP you can use conditional formating.

  4. #4
    Join Date
    Oct 2002

    Smile Re: Checking each record of a continious form

    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
    Case Else
    Me!Name.ForeColor = Blue
    Me!Age.ForeColor = Blue
    End Select

    Now you will see that your data will displayed in the manner that you specified

    Good Luck
    Last edited by Chumpie999typla; 03-17-03 at 08:15.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts