Results 1 to 8 of 8
  1. #1
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Closing a UserForm (XL2000 SR-1)

    On a multipage userform there is a [NEXT] button with the underlying code:

    Private Sub pgQNext_Click()
    MultiPage1.Value = MultiPage1.Value + 1
    UpdatePgQ
    End Sub


    I would like to insert an instruction that would check the value of Label9 (it's a self-calculating label on the form). If the value is equal to 45, then the Next button would carry on, but if the value of Label9 is anything else the form would quit. Unload Me
    - Ricky

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Closing a UserForm (XL2000 SR-1)

    Ricky,

    It's late here so maybe I am missing something. Why not use<pre> If Lable9.value <> 45 then Unload Me.</pre>

    However if your userform contains data you wish to process you might just hide it, then process it and then unload it.

    Andrew

  3. #3
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Closing a UserForm (XL2000 SR-1)

    This is designed to open the rest of the multipage userform if the condition is met, in other words, if Label9=45 then the Next button will work.
    <font color=red>
    If Lable9.value <> 45 then Unload Me</font color=red> resulted in a Compile Error: Variable Not Defined. Label9 is a textbox on the userform that updates itself as numbers are typed in elsewhere. I know that part is working, I can see the Label9 box on the form. Later when everything is working, I will set LAbel9 to invisible
    - Ricky

  4. #4
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Dallas plus 20 miles or so, Texas, USA
    Posts
    876
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Closing a UserForm (XL2000 SR-1)

    Try putting Label9 instead of lable9. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  5. #5
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Closing a UserForm (XL2000 SR-1)

    Thanks but that wasn't it!
    - Ricky

  6. #6
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Dallas plus 20 miles or so, Texas, USA
    Posts
    876
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Closing a UserForm (XL2000 SR-1)

    Shucks!

    FWIW, I don't usually use "ME", I generally use the specific name of the form. Not really sure if it makes any difference. More than likely, this will probably not help.

  7. #7
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Dallas plus 20 miles or so, Texas, USA
    Posts
    876
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Closing a UserForm (XL2000 SR-1)

    Another thought - there is no value property for a label, you might have to refer to it's caption property.

  8. #8
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Closing a UserForm (XL2000 SR-1)

    Hey Mike, not real sure how I did it but it's working now. I had to begin by decaring a variable as Long. That was a new one for me.

    If trail and error wasn't so time consuming, I could attach the word "fun" to this a little easier.
    - Ricky

Posting Permissions

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