Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Apr 2008
    Posts
    188
    Thanks
    0
    Thanked 0 Times in 0 Posts

    On Format in a Report

    I am continuing to work on a report with several subreports. See Attachment

    I have tried to add some more code to the On Format option in the Detail section.

    I setup a second If-Then statement for field "Activity 1" that would make a subreport "subrptSpeedAdvantage" visible if one of two conditions is met. That code works great.

    I then tried to add similiar code for field "Activity 2 and Activity 3 but that seems to cancel out my original Activity1 "subrptSpeedAdvantage" code.

    I can't figure out why or how else to code it. Several variations have also not worked.

    Any suggestions.

    Thanks

    Paul
    Attached Files Attached Files

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    I can't see anyhthing wrong. The code looks OK to me.

    Can you point me to a person where the report has the wrong things visible..maybe I am missing something.

    At the moment Activity1 is the only activity where "Speed Advantage Training.... " is being tested for. Is that what you want?
    Regards
    John



  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    I think I understand the issue now.

    If you had this code:
    Code:
    If Me.Activity1 = "Speed Advantage Training 10 or less Sessions" Or Me.Activity1 = "Speed Advantage Training 11-14 Sessions" Then
        Me.subrptSpeedAdvantage.Visible = True
    Else
        Me.subrptSpeedAdvantage.Visible = False
     
    End If
    
    If Me.Activity2 = "Speed Advantage Training 10 or less Sessions" Or Me.Activity2 = "Speed Advantage Training 11-14 Sessions" Then
        Me.subrptSpeedAdvantage.Visible = True
    Else
        Me.subrptSpeedAdvantage.Visible = False
     
    End If
    
    If Me.Activity3 = "Speed Advantage Training 10 or less Sessions" Or Me.Activity3 = "Speed Advantage Training 11-14 Sessions" Then
        Me.subrptSpeedAdvantage.Visible = True
    Else
        Me.subrptSpeedAdvantage.Visible = False
     
    End If
    You would have 3 separate If Then tests setting the visible propery of Me.subrptSpeedAdvantage.

    In that case the last test always wins. The first two If Then statements become irrelevant.
    So you need to combine all the tests into a single If Then test.

    You could have

    Code:
    If Me.Activity1 = "Speed Advantage Training 10 or less Sessions" Or  Me.Activity1 = "Speed Advantage Training 11-14 Sessions" Then
        Me.subrptSpeedAdvantage.Visible = True
    elseIf Me.Activity12 = "Speed Advantage Training 10 or less Sessions" Or  Me.Activity2 = "Speed Advantage Training 11-14 Sessions" Then
        Me.subrptSpeedAdvantage.Visible = True
    elseIf Me.Activity3 = "Speed Advantage Training 10 or less Sessions" Or  Me.Activity3 = "Speed Advantage Training 11-14 Sessions" Then
        Me.subrptSpeedAdvantage.Visible = True
    Else
        Me.subrptSpeedAdvantage.Visible = False
     
    End If
    or

    Code:
     If Me.Activity1 = "Speed Advantage Training 10 or less Sessions" Or  Me.Activity1 = "Speed Advantage Training 11-14 Sessions" or  Me.Activity12 = "Speed Advantage Training 10 or less Sessions" Or  Me.Activity2 = "Speed Advantage Training 11-14 Sessions" or  Me.Activity3 = "Speed Advantage Training 10 or less Sessions" Or  Me.Activity3 = "Speed Advantage Training 11-14 Sessions" Then
         Me.subrptSpeedAdvantage.Visible = True
     Else
         Me.subrptSpeedAdvantage.Visible = False
      
     End If
    Regards
    John



Posting Permissions

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