Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Must be an easier way?

Discussion in 'Information Technology' started by Ross, Jul 28, 2006.

Tags:
  1. Ross

    Ross
    Expand Collapse
    Guest

    Hi Guys
    Have a form with 3 Options to a frame with values 1, 2 or 3, these choices
    change the colour on a box panel of a diagram.
    Works a treat - problem comes when you revisit the a record - the frame
    options are correct, but of course the diagram show the previously displayed
    record.
    Have set up the code for two frames of the 27 frames under "On Current" and
    again this works a treat, but there must be a quicker and simpler way to
    cover all 27 frames.
    Current code is as follows:
    Private Sub Form_Current()
    If Me.NSFWing = 3 Then
    Me.BxNSFWing.BackColor = QBColor(12)
    If Me.NSFDoor = 3 Then
    Me.BxNSFDoor.BackColor = QBColor(12)
    Else
    If Me.NSFDoor = 2 Then
    Me.BxNSFDoor.BackColor = QBColor(14)
    Else
    Me.BxNSFDoor.BackColor = QBColor(8)
    End If
    End If
    Else
    If Me.NSFWing = 2 Then
    Me.BxNSFWing.BackColor = QBColor(14)
    If Me.NSFDoor = 3 Then
    Me.BxNSFDoor.BackColor = QBColor(12)
    Else
    If Me.NSFDoor = 2 Then
    Me.BxNSFDoor.BackColor = QBColor(14)
    Else
    Me.BxNSFDoor.BackColor = QBColor(8)
    End If
    End If
    Else
    Me.BxNSFWing.BackColor = QBColor(8)
    If Me.NSFDoor = 3 Then
    Me.BxNSFDoor.BackColor = QBColor(12)
    Else
    If Me.NSFDoor = 2 Then
    Me.BxNSFDoor.BackColor = QBColor(14)
    Else
    Me.BxNSFDoor.BackColor = QBColor(8)
    End If
    End If
    End If
    End If
    End Sub

    Any sugestions?
    Ross
     
  2. Loading...


  3. Steve Schapel

    Steve Schapel
    Expand Collapse
    Guest

    Ross,

    It looks to me like you could change the Option Values of the Option
    Buttons to 8, 14, and 12, instead of 1, 2, and 3. Then your code could
    go like this...
    Me.BxNSFWing.BackColor = QBColor(Me.NSFWing)
    Me.BxNSFDoor.BackColor = QBColor(Me.NSFDoor)
    etc

    That would simplify it to some degree.

    --
    Steve Schapel, Microsoft Access MVP

    Ross wrote:
    > Hi Guys
    > Have a form with 3 Options to a frame with values 1, 2 or 3, these choices
    > change the colour on a box panel of a diagram.
    > Works a treat - problem comes when you revisit the a record - the frame
    > options are correct, but of course the diagram show the previously displayed
    > record.
    > Have set up the code for two frames of the 27 frames under "On Current" and
    > again this works a treat, but there must be a quicker and simpler way to
    > cover all 27 frames.
    > Current code is as follows:
    > Private Sub Form_Current()
    > If Me.NSFWing = 3 Then
    > Me.BxNSFWing.BackColor = QBColor(12)
    > If Me.NSFDoor = 3 Then
    > Me.BxNSFDoor.BackColor = QBColor(12)
    > Else
    > If Me.NSFDoor = 2 Then
    > Me.BxNSFDoor.BackColor = QBColor(14)
    > Else
    > Me.BxNSFDoor.BackColor = QBColor(8)
    > End If
    > End If
    > Else
    > If Me.NSFWing = 2 Then
    > Me.BxNSFWing.BackColor = QBColor(14)
    > If Me.NSFDoor = 3 Then
    > Me.BxNSFDoor.BackColor = QBColor(12)
    > Else
    > If Me.NSFDoor = 2 Then
    > Me.BxNSFDoor.BackColor = QBColor(14)
    > Else
    > Me.BxNSFDoor.BackColor = QBColor(8)
    > End If
    > End If
    > Else
    > Me.BxNSFWing.BackColor = QBColor(8)
    > If Me.NSFDoor = 3 Then
    > Me.BxNSFDoor.BackColor = QBColor(12)
    > Else
    > If Me.NSFDoor = 2 Then
    > Me.BxNSFDoor.BackColor = QBColor(14)
    > Else
    > Me.BxNSFDoor.BackColor = QBColor(8)
    > End If
    > End If
    > End If
    > End If
    > End Sub
    >
    > Any sugestions?
    > Ross
     
  4. Ross

    Ross
    Expand Collapse
    Guest

    Spot on Steve - just what I needed - owe you one
    Cheers Ross

    "Steve Schapel" wrote:

    > Ross,
    >
    > It looks to me like you could change the Option Values of the Option
    > Buttons to 8, 14, and 12, instead of 1, 2, and 3. Then your code could
    > go like this...
    > Me.BxNSFWing.BackColor = QBColor(Me.NSFWing)
    > Me.BxNSFDoor.BackColor = QBColor(Me.NSFDoor)
    > etc
    >
    > That would simplify it to some degree.
    >
    > --
    > Steve Schapel, Microsoft Access MVP
    >
    > Ross wrote:
    > > Hi Guys
    > > Have a form with 3 Options to a frame with values 1, 2 or 3, these choices
    > > change the colour on a box panel of a diagram.
    > > Works a treat - problem comes when you revisit the a record - the frame
    > > options are correct, but of course the diagram show the previously displayed
    > > record.
    > > Have set up the code for two frames of the 27 frames under "On Current" and
    > > again this works a treat, but there must be a quicker and simpler way to
    > > cover all 27 frames.
    > > Current code is as follows:
    > > Private Sub Form_Current()
    > > If Me.NSFWing = 3 Then
    > > Me.BxNSFWing.BackColor = QBColor(12)
    > > If Me.NSFDoor = 3 Then
    > > Me.BxNSFDoor.BackColor = QBColor(12)
    > > Else
    > > If Me.NSFDoor = 2 Then
    > > Me.BxNSFDoor.BackColor = QBColor(14)
    > > Else
    > > Me.BxNSFDoor.BackColor = QBColor(8)
    > > End If
    > > End If
    > > Else
    > > If Me.NSFWing = 2 Then
    > > Me.BxNSFWing.BackColor = QBColor(14)
    > > If Me.NSFDoor = 3 Then
    > > Me.BxNSFDoor.BackColor = QBColor(12)
    > > Else
    > > If Me.NSFDoor = 2 Then
    > > Me.BxNSFDoor.BackColor = QBColor(14)
    > > Else
    > > Me.BxNSFDoor.BackColor = QBColor(8)
    > > End If
    > > End If
    > > Else
    > > Me.BxNSFWing.BackColor = QBColor(8)
    > > If Me.NSFDoor = 3 Then
    > > Me.BxNSFDoor.BackColor = QBColor(12)
    > > Else
    > > If Me.NSFDoor = 2 Then
    > > Me.BxNSFDoor.BackColor = QBColor(14)
    > > Else
    > > Me.BxNSFDoor.BackColor = QBColor(8)
    > > End If
    > > End If
    > > End If
    > > End If
    > > End Sub
    > >
    > > Any sugestions?
    > > Ross

    >
     

Share This Page