Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cancel on open event without opening form

Status
Not open for further replies.

kermit01de

Technical User
Jan 20, 2002
256
DE
The next one from me ...

I have some code in the on open event on my switchboard, that opens another form. Both are PopUp = Yes, so that the switchboard comes in front.

I tried to docmd.minimize before opening the other form - that works, but

a) Howto automatically maximize switchboard after closing
- or -
b) stop opening switchboard in the on open event so that I may open it when closing the other form.

btw: modal = Yes did not help

Thank you.



--------------------------------------
>>>>>> Bugs will appear in one part of a working program when another 'unrelated' part is modified <<<<<
 
How are ya kermit01de . . .

Typically this is backwards as far as switchboard operations are concerned. Normally the form would be selected from the switchboard and at the time of selection the switchboard is fully rendered. Its this [blue]time to render[/blue] that appears to be the problem. [purple]Fully rendered pop-up forms allow called pop-ups to appear on top[/purple].

I was able to simulate your problem and found it frustrating to derive resolution. Consider the following:
Microsoft said:
[blue]When you open a form, the following sequence of events occurs for the form:

[purple]Open ? Load ? Resize ? Activate ? Current[/purple][/blue]
Not only did I find the [purple]Activate[/purple] event never occured, but moving [blue]DoCmd.OpenForm[/blue] to each event (to open another pop-up) produced no joy. This indicitive of a timing problem as far as opening the two forms is concerned.

So to solve this some sort of timing is required to allow the switchboard to reach a certain point in render. Using the forms [blue]On Timer[/blue] event and [blue]Timer Interval[/blue] property, I found that [blue]1 millisecond[/blue] was enough. However I used [blue]10 milliseconds[/blue] for good measure. So perform the following for resolution:
[ol][li]Remove all prior code to handle this problem. This is to prevent interaction.[/li]
[li]In the forms [blue]On Open[/blue] event, copy/paste the following line:
Code:
[blue]   Me.TimerInterval = 10[/blue]
[/li]
[li]In the forms [blue]On Timer[/blue] event, copy/paste the following:
Code:
[blue]   Me.TimerInterval = 0 [green]'Timer Off![/green]
   DoCmd.OPenForm "[purple][B][I]YourFormName[/I][/B][/purple]"[/blue]
[/li]
[li][blue]Thats it! Perform your testing ...[/blue][/li][/ol]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
What I did ...

Open switchboard, minimize if the pop up is shown, have a button on the pop up that closes itself and restores switchboard.



--------------------------------------
>>>>>> Bugs will appear in one part of a working program when another 'unrelated' part is modified <<<<<
 
kermit01de . . .

Did you at least try my method?

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Sorry, AceMan, as I already use the timer for another purpose it was not possible to test your solution yet ... But I will do now ... just to see if it works.

--------------------------------------
>>>>>> Bugs will appear in one part of a working program when another 'unrelated' part is modified <<<<<
 
Yes AceMan, that was great! It works properly - as expected.

Thank you for your input!

--------------------------------------
>>>>>> Bugs will appear in one part of a working program when another 'unrelated' part is modified <<<<<
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top