On Wed, 23 Jun 2004 11:14:23 +1200, "WindAndWaves" <ac****@ngaru.com> wrote:
Hi Gurus
I am trying to make a custom message box with a dialog form.
Here is how I would like to do it:
1- anywhere in the database, in any procedure, I call the function that
opens a dialog form
2- users clicks on a button in the custom form
3- answer from user is passed back to original procedure (e.g. whether
the answer was Yes or No).
I can do all of this but I can not pass the answer (the click of a button)
back to the original function (3).
Any suggestions?
Thank you
Nicolaas
A dialog form will halt all code execution (except code in the dialog form itself) until the form is closed or hidden.
The method I use for returning a value from a dialog form is to hide the form rather than close it. This will allow code
execution to continue in the calling routine, but the values from the hidden dialog form are still available. Your
calling function grabs the value(s) it needs from the dialog and then closes the form.
eg
DoCmd.OpenForm "frmMyDialog", , , , , acDialog
'code execution stops here
'when the dialog form is hidden execution resumes
vSomeVariable = Forms!frmMyDialog!SomeControl
'now close the dialog form
DoCmd.Close acForm, "frmMyDialog"
The code behind your "Close" button on the dialog form would be -
Me.Visible = False
Wayne Gillespie
Gosford NSW Australia