How to pause code when calling custom message box form?

Do compare like with like. Relying on something not obvious nor immediately evident as, in this particlular case, the resumption of program flow in the calling form relying upon termination of visibility of the modal called form and not its closing, is hardly equivalent to some single statement that the purists can disect ad nauseam.
 
Do compare like with like. Relying on something not obvious nor immediately evident as, in this particlular case, the resumption of program flow in the calling form relying upon termination of visibility of the modal called form and not its closing, is hardly equivalent to some single statement that the purists can disect ad nauseam.

I am not sure I agree.

Rolling you own input box is not trivial and not immediately obvious.

I tend to open the form, set a while loop that waits for it to close, and then retrieve the value from a public variable. Galaxiom prefers not to use public variables - so you need to "know" when the form's state has changed to determine when the program can determine the value, and carry on. This isn't actually a simple or obvious thing to do, and requires a bit of sleight of hand, however you do it.

inputbox and msgbox don't set public variables, but they do it somehow ....
 
Spikepl.

I think all post #17 is, is an attempt to tear down another perfectly good method of doing it.

I think this is an educational site so why try to tear down another method based on your perception of what is obscure and what you might forget in 6 months time?

If you have so much trouble remembering why you did something 6 months ago then VBA has a facility called comments.
From post #15 by Nigel:-
Code:
[color=green]' Open the form as a dialog
' Waits here until msgCustom closes or is made invisible[/color]
  DoCmd.OpenForm "msgCustom", , , , , acDialog

So, rather than trying to tear down a perfectly good method simply because you might forget it in 6 months, may I suggest you use comments in your code and leave it up to other people which method they prefer to use.

Chris.
 
I tend to open the form, set a while loop that waits for it to close, and then retrieve the value from a public variable. Galaxiom prefers not to use public variables - so you need to "know" when the form's state has changed to determine when the program can determine the value, and carry on.

I would be more inclined to try opening the dialog form invisible, pass the calling form's identity to a custom property then make it visible.

The user enters the value and the event triggered writes to where the calling form told it.

No looping or state detection involved.

Of course I have not done this yet since I only found out about the use of visble property yesterday so I may be barking up the wrong tree.
 

Users who are viewing this thread

Back
Top Bottom