Help with DIALOG Window

  • Thread starter Thread starter Pete Beatty
  • Start date Start date
P

Pete Beatty

I am having a problem with my dialog window. I have a form that process
some data and activates a dialog window when an error occurs. On the dialog
window, there is a button that executes the "docmd.close" command. Upon
execution, the dialog form and the form that executed the original
"OpenForm" also closes. I have placed some code snippets below to assist.

I have bracketed the "OpenForm" and the "Close" commands. when the Dialog
closes the window, it transfers to the "Close" procedure in the calling
form. I do not understand this action and need to close this error. The
way I understand it, the dialog window should transfer control the
instruction following the instantiation of the form. WHAT IS GOING ON???
Any Ideas would be appreciated.

Form 1 (Import Records)

Process records until eof
If errors found
stDocName = "frmCheck Member Duplication"
strLink = "[DupConstant] = """ & tmpDup & """"
DoCmd.OpenForm stDocName, acViewForm, , strLink, acFormReadOnly,
acDialog, tmpDup
endif
next record

sub close
close the DB
clear the public variables
end sub

* there are not other significant subs (e.g. deactivate, unload)


Form 2 (frmCheck Member Duplication)
correct the errors

sub cmdcloseform
docmd.close
end sub

* this is the only sub procedure in the form
 
It may be that DoCmd.Close is doing this. Before we troubleshoot a lot more,
change the code in the dialog form to this:

DoCmd.Close acForm, Me.Name, acSaveNo

This will ensure that the command will close just the dialog form.

Also, when you post code, please post the exact code. What you have posted
is just generic logic statements, and does no one any good if he/she wants
to try to troubleshoot your code....
 
Back
Top