Consulting

Results 1 to 3 of 3

Thread: Sleeper: Populating a chart with contents of frame only if option box is selected?

  1. #1

    Sleeper: Populating a chart with contents of frame only if option box is selected?

    I have a user form with a "Select all that apply" series of boxes.


    When the user selects OptionBox A, a frame appears with pass/fail radio buttons and six text boxes which store the upper and lower ends of three different ranges.
    So: Option Box 1 is selected and then that runs: Pass/fail then Range 1 X% to X% Range 2 X% to X% Range 3 X% to X%


    I only want to insert the answers from the three "All that Apply" Boxes that are toggled, have those pass/fail and range boxes to populate a table when the OptionBox is selected. When it is not selected, I would like nothing to appear, so no "Error! No Document Variable Supplied!" So, it would work if just OptionBox 1 is selected, it runs the code for 1, then if 1 and 3, only one and 3 skipping 2, etc.
    I'm doing all of this with Doc Variables, I don't know if that's the right way to go. The code listed below works in that it populates the doc with the entries, but it displays with "Error! Document Variable not Supplied!" if I don't list anything and I'm not sure how to get it to not do that.


    So this is part of the code:

    Private Sub CommandButton2_Click()
    If OptionButton11.Value = True Then oVars("RecoveryPass") = _ 
    "Pass      language." Else oVars("RecoveryPass") = _ 
    "Fail: Failure statement." 
    ActiveDocument.Fields.Update 
    Me.Repaint 
    End If
    If CheckBox2 = True Then Set oVars = ActiveDocument.Variables oVars("Mean1").Value = Me.Mean1.Value ActiveDocument.Fields.Update Me.Repaint
    Set oVars = ActiveDocument.Variables
    oVars("Mean2").Value = Me.mean2.Value
    ActiveDocument.Fields.Update
    Me.Repaint
    Set oVars = ActiveDocument.Variables
    oVars("HW1").Value = Me.HW1.Value
    ActiveDocument.Fields.Update
    Me.Repaint
    Set oVars = ActiveDocument.Variables
    oVars("HW2").Value = Me.HW2.Value
    ActiveDocument.Fields.Update
    Me.Repaint
    Set oVars = ActiveDocument.Variables
    oVars("LS1").Value = Me.LS1.Value
    ActiveDocument.Fields.Update
    Me.Repaint
    Set oVars = ActiveDocument.Variables
    oVars("LS2").Value = Me.LS2.Value
    ActiveDocument.Fields.Update
    Me.Repaint
    End If
    Me.Repaint UserForm3.hide
    End Sub
    I have very little idea of what I'm doing, this is my first time working on anything like this and it's making me want to jump out the window.

  2. #2
    Followup question, possible alternative solution:

    Would it be possible to just make it delete the row out of the table? So instead of having it not update the table with that info, could I leave the code as is, but tag a delete command onto the end? "If this box isn't checked, delete this row?"

  3. #3
    Table. The item I'm trying to manipulate is a Table, not a Chart.

    Signed,
    Extra, Extra Dumb

Tags for this Thread

Posting Permissions

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