N
Nicholas Scarpinato
Hello. I'm having a bit of a hard time wrapping my head around exactly why
this isn't working the way I have it written, because I'm quite sure I've
done this very same thing before and it worked just fine. What I'm trying to
do is use a single form to display a variety of system messages
programmatically, but I want this form to stop the code until the user clicks
the OK button. I don't want to put an infinite loop code into the form
because that seems rather wasteful, and I know a modal form stops the code
from running until the user closes the form... but therein lies the problem.
What's happening is that since the modal property of the form stops the code
from executing, the form opens and stops the code before the line that
changes the text of the label has a chance to be processed. Then when the
form is closed I get the "Access cannot find the form" message. If I open the
form in hidden mode first and change the label and then re-open it in it's
normal state (without saving it and closing it first), the label changes but
the code executes in the background. I'm starting to think that the only way
to solve this is to open the form in hidden mode, make the appropriate
changes, save it, then reopen it again in it's normal mode. I just don't want
to do all that if I can help it.
Here's a sample of the current code:
DoCmd.OpenForm "Bin Confirmation Form", , , , , acDialog
Forms![Bin Confirmation Form].[BinSelectionText].Caption = "Bin location
found!" & vbNewLine & "Please use bin " & BinLoc & "."
Forms![Bin Confirmation Form].Modal = True
Am I missing something that should be blatantly obvious, or is there really
no other way to do what I'm trying to do than to save the form and reopen it?
this isn't working the way I have it written, because I'm quite sure I've
done this very same thing before and it worked just fine. What I'm trying to
do is use a single form to display a variety of system messages
programmatically, but I want this form to stop the code until the user clicks
the OK button. I don't want to put an infinite loop code into the form
because that seems rather wasteful, and I know a modal form stops the code
from running until the user closes the form... but therein lies the problem.
What's happening is that since the modal property of the form stops the code
from executing, the form opens and stops the code before the line that
changes the text of the label has a chance to be processed. Then when the
form is closed I get the "Access cannot find the form" message. If I open the
form in hidden mode first and change the label and then re-open it in it's
normal state (without saving it and closing it first), the label changes but
the code executes in the background. I'm starting to think that the only way
to solve this is to open the form in hidden mode, make the appropriate
changes, save it, then reopen it again in it's normal mode. I just don't want
to do all that if I can help it.
Here's a sample of the current code:
DoCmd.OpenForm "Bin Confirmation Form", , , , , acDialog
Forms![Bin Confirmation Form].[BinSelectionText].Caption = "Bin location
found!" & vbNewLine & "Please use bin " & BinLoc & "."
Forms![Bin Confirmation Form].Modal = True
Am I missing something that should be blatantly obvious, or is there really
no other way to do what I'm trying to do than to save the form and reopen it?