+ Reply to Thread
Results 1 to 3 of 3

Closing a Form

  1. #1
    Mike
    Guest

    Closing a Form

    I have a Form that allows a user to select one of three voltage ranges. Once
    a selection is made, I want the form to close. Thus far I have tried using
    "Unload frmStartupRange" and "frmStartupRange.Hide" both with no sucess. The
    form does not close until there is a display change. I have included some of
    the code below. Any help would be greatly appreciated.

    Thanks,
    Mike

    This is the code for the Form:
    Private Sub Europe_Click()
    WhichRange = "Eu"
    Unload frmStartupRange
    End Sub
    Private Sub Japan_Click()
    WhichRange = "Ja"
    Unload frmStartupRange
    End Sub
    Private Sub NorthAmerica_Click()
    WhichRange = "NA"
    Unload frmStartupRange
    End Sub
    Private Sub UserForm_Click()
    End Sub



  2. #2
    Jim Cone
    Guest

    Re: Closing a Form

    Is WhichRange a module level String variable?
    Is the form name actually...frmStartupRange?
    Try adding "DoEvents" before unloading the form...

    Private Sub Europe_Click()
    WhichRange = "Eu"
    DoEvents
    frmStartupRange.Hide
    Unload frmStartupRange
    End Sub
    --
    Jim Cone
    San Francisco, USA
    http://www.realezsites.com/bus/primitivesoftware


    "Mike" <[email protected]>
    wrote in message...
    I have a Form that allows a user to select one of three voltage ranges. Once
    a selection is made, I want the form to close. Thus far I have tried using
    "Unload frmStartupRange" and "frmStartupRange.Hide" both with no sucess. The
    form does not close until there is a display change. I have included some of
    the code below. Any help would be greatly appreciated.

    Thanks,
    Mike

    This is the code for the Form:
    Private Sub Europe_Click()
    WhichRange = "Eu"
    Unload frmStartupRange
    End Sub
    Private Sub Japan_Click()
    WhichRange = "Ja"
    Unload frmStartupRange
    End Sub
    Private Sub NorthAmerica_Click()
    WhichRange = "NA"
    Unload frmStartupRange
    End Sub
    Private Sub UserForm_Click()
    End Sub



  3. #3
    Mike
    Guest

    Re: Closing a Form

    Jim,
    Thanks for the reply. Using "DoEvents", I was able to make it work,
    although differently than what you had listed.

    FYI, WhichRange is a "Public" variable. "frmStarupRange" is the actual form
    name.
    Here is what I wound up doing.

    Module Calling for the form:
    Sub GPIB_Load()
    frmStartupRange.Show
    DoEvents
    End Sub

    The form:
    Private Sub Europe_Click()
    WhichRange = "Eu"
    Unload frmStartupRange
    End Sub

    Thanks Again,
    Mike



    "Jim Cone" wrote:

    > Is WhichRange a module level String variable?
    > Is the form name actually...frmStartupRange?
    > Try adding "DoEvents" before unloading the form...
    >
    > Private Sub Europe_Click()
    > WhichRange = "Eu"
    > DoEvents
    > frmStartupRange.Hide
    > Unload frmStartupRange
    > End Sub
    > --
    > Jim Cone
    > San Francisco, USA
    > http://www.realezsites.com/bus/primitivesoftware
    >
    >
    > "Mike" <[email protected]>
    > wrote in message...
    > I have a Form that allows a user to select one of three voltage ranges. Once
    > a selection is made, I want the form to close. Thus far I have tried using
    > "Unload frmStartupRange" and "frmStartupRange.Hide" both with no sucess. The
    > form does not close until there is a display change. I have included some of
    > the code below. Any help would be greatly appreciated.
    >
    > Thanks,
    > Mike
    >
    > This is the code for the Form:
    > Private Sub Europe_Click()
    > WhichRange = "Eu"
    > Unload frmStartupRange
    > End Sub
    > Private Sub Japan_Click()
    > WhichRange = "Ja"
    > Unload frmStartupRange
    > End Sub
    > Private Sub NorthAmerica_Click()
    > WhichRange = "NA"
    > Unload frmStartupRange
    > End Sub
    > Private Sub UserForm_Click()
    > End Sub
    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1