Question : Code Pause - sometimes

I have searched a bit on EE and have not found anything that is quite what I need.

Have a form that I use to search customers ("SEARCH"). Works great.
Have a 2nd form that is a job sheet, which is tied to a certain customer "JOB"). Also works great.

I want to give the option to change the customer by calling SEARCH to make the choice then pass it back to the JOB form. At this stage I inserted a msgbox (in JOB form code) to show me the returned value after a selection is made. (Some of you probably already know the issue)

Problem is this...
When the SEARCH form is called from the code in the JOB form, all is well - but - the msgbox pops up immediately after the SEARCH form opens and I cannot figure out a way to get a new selected value without the code all rolling past where it needs to be reassigned. I want JOB form to wait until a selection is made on the SEARCH form (have a button there called "select") so that the correct, new customer ID is chosen.

Can I do this without resorting to using a potentially endless loop (with docmds as part of code)?


Answer : Code Pause - sometimes

Can you call the Search form in Dialog mode? This would stop all code execution on the Job form until you close the Search form. At that point, the code in the Job form would start running again.

Note with a dialog form, the user MUST interact with that form (and that form alone) until it's closed.

Here's how to open a form in Dialog mode:

DoCmd.OpenForm "YourForm",acNormal, , , ,acDialog
Random Solutions  
 
programming4us programming4us