locked
acDialog form does not return and clear the call stack RRS feed

  • Question

  • I open a form with the statement:

      DoCmd.OpenForm "frm_RecordKeyError", , , , , acDialog

    I've done this in several other programs and they work just fine. This one opens the form and the code stops processing (just as it should). When the form closes, it does not return to the place in the code that it was called from. The function that calls this openform is about 4 levels deep in the call stack. When this "dialog" form closes It returns to the Original form and all code has finished even though it should have been 3-4 levels deep in the stack.

    Leo


    Leo Krupp


    • Edited by KruppClerk Tuesday, November 26, 2013 3:04 AM
    Tuesday, November 26, 2013 3:01 AM

Answers

  • Hi Leo,

    >> When this "dialog" form closes It returns to the Original form and all code has finished even though it should have been 3-4 levels deep in the stack <<

    What do you mean “it should have been 3-4 levels deep in the stack”? Which version of Access are you using?
    I created 4 forms in Access 2013 as figures below:

    There is a button in the frmForm1, frmForm2, frmForm3. The frmForm1 will open frmForm2 and frmForm2 will open frmForm3, at last the frmForm3 open the frmDialog.
    The code in the frmForm1 as below:

    Private Sub Command0_Click()
    DoCmd.OpenForm "frmForm2", , , , , acFormDS
    MsgBox "return frmForm1"
    End Sub
    The code in the frmForm2 as below:
    Private Sub Command0_Click()
    DoCmd.OpenForm "frmForm3", , , , , acFormDS
    MsgBox "return From2"
    End Sub
    The code in the frmForm3 as below:
    Private Sub Command0_Click()
    DoCmd.OpenForm "frmDialog", , , , , acFormDS
    MsgBox " return From3"
    End Sub

    The code ran well when I close the dialog, it return the code who call it like below:

    I suggest you setting a breakpoint to the code to see whether there is anything wrong in the code.

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, November 27, 2013 6:45 AM

All replies

  • Hi Leo,

    >> When this "dialog" form closes It returns to the Original form and all code has finished even though it should have been 3-4 levels deep in the stack <<

    What do you mean “it should have been 3-4 levels deep in the stack”? Which version of Access are you using?
    I created 4 forms in Access 2013 as figures below:

    There is a button in the frmForm1, frmForm2, frmForm3. The frmForm1 will open frmForm2 and frmForm2 will open frmForm3, at last the frmForm3 open the frmDialog.
    The code in the frmForm1 as below:

    Private Sub Command0_Click()
    DoCmd.OpenForm "frmForm2", , , , , acFormDS
    MsgBox "return frmForm1"
    End Sub
    The code in the frmForm2 as below:
    Private Sub Command0_Click()
    DoCmd.OpenForm "frmForm3", , , , , acFormDS
    MsgBox "return From2"
    End Sub
    The code in the frmForm3 as below:
    Private Sub Command0_Click()
    DoCmd.OpenForm "frmDialog", , , , , acFormDS
    MsgBox " return From3"
    End Sub

    The code ran well when I close the dialog, it return the code who call it like below:

    I suggest you setting a breakpoint to the code to see whether there is anything wrong in the code.

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, November 27, 2013 6:45 AM
  • I suggest you place a MSGBOX right after the call to open the form in Dialog Mode.

    If the MSGBOX opens before the form closes, that's a bug.
    I've seen other issues with opening a form in dialog mode....namely forms in SplitForm mode.

    Which version of Access are you using ?

    Wednesday, November 27, 2013 4:12 PM