Results 1 to 11 of 11
  1. #1
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Northern, NJ, New Jersey, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Turn Box On/Off (2000 SP1)

    I have a form that users are populating information that ultimately creates varying Price Strips for a Retail Store. Based on 4 yes/no boxes certain elements are shown or hidden.
    For Example:
    =IIf(([Rebate]=False) And ([NoAccPack]=True) And ([MinutePacks]=True) And ([PAYGo]=False),[Col1MinPakLine1],Null)

    I need to be able to show/hide a rectangle or line drawn in using the same iif statement. Can that be done???

    Where in the Properties of the Box would I enter that control?
    There is always a way.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Turn Box On/Off (2000 SP1)

    You can use code in the After Update event of the check boxes to manipulate a rectangle. In its most primitive form:

    Private Sub CheckBox1_AfterUpdate()
    Me.Rectangle1.Visible = Me.CheckBox1
    End Sub

    but you can make it as sophisticated as you want.

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

    Re: Turn Box On/Off (2000 SP1)

    You can show or hide lines or rectangles by setting the visible property of the line or rectangle to true or false.
    Regards
    John



  4. #4
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Northern, NJ, New Jersey, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Turn Box On/Off (2000 SP1)

    Thanks... I need to reference each of the four check boxes like in the iif above

    Can you give me somehting I can use in that case?
    There is always a way.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Turn Box On/Off (2000 SP1)

    Something like

    Private Sub CheckBox1_AfterUpdate()
    Me.Rectangle1.Visible = (Me.Rebate = False And Me.NoAccPack = True And _
    Me.MinutePacks = True And Me.PAYGo = False)
    End Sub

  6. #6
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Northern, NJ, New Jersey, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Turn Box On/Off (2000 SP1)

    This worked perfectly but I need to tell you more..
    How do I add an opposite controle for another box. There are actually 12 boxes total and there is only one visible at a time based on the selections made in the 4 check boxes.
    I realize this is getting complicated but I am trying to make this up on my own before posting and it "ain't workin for me"

    Maybe some sort of 'if' changin the true false combination for each?
    There is always a way.

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Turn Box On/Off (2000 SP1)

    You'd best take a large piece of paper, and work out what the relationship between the check box values and the visibility of the boxes is. With 4 check boxes, there are 2 * 2 * 2 * 2 = 16 on/off combinations,

    <table border=1><tr><td align=center>Check 1</td><td align=center>Check 2</td><td align=center>Check 3</td><td align=center>Check 4</td><td align=center>Box1</td><td align=center>Box2</td><td align=center>

  8. #8
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Northern, NJ, New Jersey, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Turn Box On/Off (2000 SP1)

    in this case there is NO time when check3 and check4 are both true.
    I am tryign for something like:

    Private Sub CheckBox1_AfterUpdate()
    If (Me.Rebate = True And Me.NoAccPack = False And _
    Me.MinutePacks = False And Me.PAYGo = False) Then Me.Box7.Visible
    End If
    Else
    (Me.Rebate = True And Me.NoAccPack = False And _
    Me.MinutePacks = False And Me.PAYGo = False) Then Me.Box7.Visible
    End If
    with more else's but do not know the correct formatting for this to work.
    There is always a way.

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Turn Box On/Off (2000 SP1)

    Ok, so the last for rows in the scheme can be deleted. You'll still have to work out the rest of it. The code you're trying now doesn't make much sense.

  10. #10
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Northern, NJ, New Jersey, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Turn Box On/Off (2000 SP1)

    I know its wrong [img]/forums/images/smilies/ohmy.gif[/img]) ...can't blame a guy for trying.

    Yes the last 4 can be ignored and each of the 12 scenarios have a different box. If the scenario is true than that box is visible, if it is not than that box is invisible.
    There is always a way.

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Turn Box On/Off (2000 SP1)

    I keep on repeating this. You will have to work out the "plan" with all 12 allowed combinations of the check boxes, and determine which box is to be visible. You then write code like this:

    Me.Box1.Visible = (Not Me.CheckBox1 And Not Me.CheckBox2 And Not Me.CheckBox3 And Not Me.CheckBox4)
    Me.Box2.Visible = (Me.CheckBox1 And Not Me.CheckBox2 And Not Me.CheckBox3 And Not Me.CheckBox4)
    Me.Box3.Visible = (Not Me.CheckBox1 And Me.CheckBox2 And Not Me.CheckBox3 And Not Me.CheckBox4)
    ...
    Me.Box12.Visible = (Me.CheckBox1 And Me.CheckBox2 And Not Me.CheckBox3 And Me.CheckBox4)

    Of course, the exact correspondence will be different. That is what you need the plan for.

Posting Permissions

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