Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2011
    Posts
    31

    Unanswered: Referencing variables from a form

    I've been able to create reports using report wizard based on queries so far but for additional function i would like a method of highlighting records.

    I would like to run a mathematical comparison with two conditions that will highlight a particular record if both conditions are met.

    This was my first attempt, but i am not sure how to execute it or if i am not referring to the variable properly.

    Private Sub Report_Current()

    If [%Difference from LDRL] > 0.2 & ([Average DAP] - [Local Diagnostic ReferenceLevel]) >= [2 x SEM] Then
    Me.[%Difference from LDRL].BackColor = RGB(255, 0, 0)
    Me.[Room].BackColor = RGB(255, 0, 0)
    Else
    If [%Difference from LDRL] > 0.2 Then
    Me.[%Difference from LDRL].BackColor = RGB(255, 0, 0)
    Else
    Exit Sub
    End If
    End If
    End Sub

    The items in the square brackets are the names of the variables i would like the comparison to be made from and highlighted where valid. Alternatively, how could i highlight that entire row containing that record where the 2 conditions are met??

    When referencing variables in reports, is it similar to accessing controls in forms where the variable is denoted as [Forms]![FormName]![Formvariable], so that it would be [Reportss]![ReportName]![Reportvariable] or is it a matter of where i include the code?

  2. #2
    Join Date
    Jun 2011
    Posts
    31
    Stumbled accross conditional formatting, but how and where can i apply the expression for two fields to be highlighted when both conditions are met such that

    if (([Average DAP]- [Local Diagnostic Reference Level])>=[2 x SEM]) & ([% Difference from LDRL]>0.2)

    is true then highlight either that entire record and make bold... or highlight the name of the room and the %difference field?

    I've been able to execute each separately by setting conditional formatting on individual boxes in the detail field, but it would be of better benefit to highlight the entire record.
    Last edited by clownyj; 07-13-11 at 09:12.

  3. #3
    Join Date
    Jun 2011
    Posts
    31
    Simple mistake....using AND instead of & in the conditional formatting tab

Posting Permissions

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