Welcome to SPN

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

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

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

    >
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page