Results 1 to 7 of 7

Thread: Abort a form in Load event

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 1999
    Location
    Leicester, UK
    Posts
    123
    What is the cleanest, safest way to abort a form in the load event? For example, if a particular condition is not satisfied and we don't want the user to continue.

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    Code:
    Unload Me
    Is Good

  3. #3
    Fanatic Member Jerry Grant's Avatar
    Join Date
    Jul 2000
    Location
    Dorset, UK
    Posts
    810

    Wink

    Keep code out of the Load event and put it in a Public form function:

    Load Myform
    Result = Myform.OpenFunction
    If Result = Fail Then
    Unload.Myform
    Else
    Myform.Show [vbModal/vbModeless]
    End if

    Jerry Grant................tnarG yrreJ
    Website: <JG-Design></.net>
    Email: [email protected]
    Working towards a bug free world......
    (Not a Microsoft employee)

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 1999
    Location
    Leicester, UK
    Posts
    123
    Sam: No its not!!! (OK it is, but only in the most simplistic scenarios)

    Jerry: Looks promising - I'll try it

    Thanks

  5. #5
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    If it's the First thing in the Load Event it's doing pretty much the Same thing as Jerry's Code. Or is there something I'm missing?

  6. #6
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <P>

    in Sam's defense...the question was how to abort..
    the answer is correct...
    however, prevention should outweight reaction!

    "If the condition is not met the form should never be
    loaded."
    Conditions should be checked before load is
    called. If the form has to load to check conditions then
    you are not aborting you are quitting.

    Have fun...just my 1 cent's worth....
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Feb 1999
    Location
    Leicester, UK
    Posts
    123
    I refuse to be drawn into a semantic argument!!!!!

    However, "If the condition is not met the form should never be loaded." This makes sense - this, I believe, is the way to go.

    Thanks all!!


Posting Permissions

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



Click Here to Expand Forum to Full Width