Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2003
    Location
    Belgium
    Posts
    133

    Unanswered: Close a dialog form without returning controle

    Hello all,

    Could anyone help me with this problem :

    I have a form frmA with a button with following code :
    DoCmd.OpenForm "frmB", , , , , acDialog

    This opens form frmB as a dialogbox, meaning control will be returned to the code in frmA when frmB is closed.

    So far so good, this works fine.
    But what I want to do as well : I want to close frmB without control being returned to frmA.
    So far, everything I've tried always returns control to the code in frmA.

    Anyone knows the code for this (or a workaround?)

  2. #2
    Join Date
    Feb 2004
    Posts
    106
    What form do you want to give control to afer closing frmB ??

  3. #3
    Join Date
    Jun 2003
    Location
    Belgium
    Posts
    133
    Originally posted by Yildirim
    What form do you want to give control to afer closing frmB ??
    Control has to be returned to frmA but I don't want the code to be executed that is after the opening of frmB.

  4. #4
    Join Date
    Feb 2004
    Posts
    199
    ? if you don't want code continued anyway, why do you put a code after form open command, or code should be done depending some conditions?
    MDB, ADP <-> MS SQL + VBA, ADO & RDO, .NET, Oracle, Java/Jsp.

  5. #5
    Join Date
    Jun 2003
    Location
    Belgium
    Posts
    133
    Originally posted by Kakha
    ? if you don't want code continued anyway, why do you put a code after form open command, or code should be done depending some conditions?
    On form frmB, I have 2 buttons : Cancel and Abort
    The Cancel button should just close frmB and coontinue with the code on frmA after the form open command.
    With the Abort button, I also want frmB to close but the code after the open form command may not be executed.

    I tried with the command End but then I loose all my local variables in frmA module and I don't want that to happen.

    Any ideas?

  6. #6
    Join Date
    Feb 2004
    Posts
    106
    How about using the exit sub command?

  7. #7
    Join Date
    Jun 2003
    Location
    Belgium
    Posts
    133
    Originally posted by Yildirim
    How about using the exit sub command?
    Does not work : control is returned to frmA and following code is executed.
    I could of course set an exit sub command in that following code as well but then it would not be executing in no case at all and I need both possibilities.

  8. #8
    Join Date
    Feb 2004
    Posts
    199
    I see, your problem is in comunicating to forms
    way 1: do not close formB, just hide , put on it a hidden text box and after user clicks a button write in it button name or some flag as you need, after the caller form returns control, it should check the formB's hidden control and behave according it.

    way2: declare a public variable in formA and make formB write a flag to FormA public variable
    MDB, ADP <-> MS SQL + VBA, ADO & RDO, .NET, Oracle, Java/Jsp.

  9. #9
    Join Date
    Jun 2003
    Location
    Belgium
    Posts
    133
    Originally posted by Kakha
    I see, your problem is in comunicating to forms
    way 1: do not close formB, just hide , put on it a hidden text box and after user clicks a button write in it button name or some flag as you need, after the caller form returns control, it should check the formB's hidden control and behave according it.

    way2: declare a public variable in formA and make formB write a flag to FormA public variable
    OK, I was just testing something similar : I put on frmA 3 hidden textboxes that I use to store my variables temporarily.
    Like this I can close frmB, use the End command and still have my variables available.

    Thanks for the info!

Posting Permissions

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