Free Lessons
Fast Tips
Topic Index
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
Home > Forums > Developers
Back to Access Developer Forum    Comments List
Form opens behind main form Upload Images   Link   Email  
Peter van Soest       
46 days ago
I have a button on my main form which opens my Follow up contact list:  
DoCmd.OpenForm "FollowupF"

I added this command to the onload event of the main form, so every time I open the main form, the follow up list also opens.
The problem is that this form opens behind the main form for the most part, so it is not visible untill I click on the part that is  visible.

This only happens when the form is opened through the onload event.
When I open the form by clicking on the button it is shown in front of the main form.

How can I fix this?

When I change the form propertie other/Pop up  to yes, it does open in front, but not on the screen my main form is opened.
I work on three screens and the popup opens on screen 1, where my main form is on screen 3

other/modal yes has no effect.

Pls advice!

grtz Peter
Peter van Soest       
46 days ago

Kevin Robertson            
46 days ago
Going to need to see your code and properties. Just showing us the Form doesn't help to troubleshoot your problem.
Peter van Soest       
46 days ago

Peter van Soest       
46 days ago

Christopher Hankwembo    
46 days ago
Why not using a macro direct on the main form so that when you want to see that form you simply click the button the form
Peter van Soest       
46 days ago
I have a button on the form that I can click to open the form, but somehow I just don't click on it regularly. And when it opens autmatically on opening the main form i'll see it at least once a day
Kevin Robertson            
46 days ago
Try reopening the form in the main form's Activate event.

Private Sub Form_Activate()

    If CurrentProject.AllForms("FollowupF").IsLoaded Then
        DoCmd.OpenForm "FollowupF"
    End If
End Sub
Kevin Robertson            
46 days ago

Peter van Soest       
46 days ago
@kevin: I don't understand, where do I put this code?
Marc Lievens        
46 days ago
Or just set timerinterval at 100 (1000 = 1 second) and in the on timer event load the form, set the timerinterval at 0 at the end.

Private Sub Form_Timer()
    DoCmd.OpenForm "FollowupF"
    Me.TimerInterval = 0
End Sub
Marc Lievens        
46 days ago

Peter van Soest       
45 days ago
@Marc: Great! That did it, tnx!
Never use the timer event before....
Richard Rost             
44 days ago
See: Load Faster. Same trick. :)
Thomas Gonder       
41 days ago
It helps to know the BIG reason why your second form is behind the first. When Access finishes the Form_Load, the first form still isn't visible. However, the second form will finish all its procedures before the code continues in the 1st form's Form_Load. Modal, popup and acDialog all say to Access that you want the second form to have a priority, although they differ somewhat in how.

If you set breakpoints at the end of procedures, you may find that many procedures may run when opening a form, some even running more than once depending on how your form works. So, this makes it difficult to anticipate where to put the second form's open as it may open twice and cascade problems depending on what that form does. I've caught the Form_Load, Current and Activate procedures running more than once.

Marc's timer trick works because the timer doesn't begin until all the "opening" procedures terminate. You could accomplish the same by finding the last procedure that runs when your particular first form is finished opening, as long as the form is then visible during that procedure. If that particular procedure can run more than once, like the Form_Activate procedure, then you'll need a form module variable (boolean) to allow it to run only once.

There's a small problem with using the timer trick, in that you may legimately use the timer to test for things like logging, user inactivity, network-wide forced shutdowns, etc. Your code can remain in timer (if used as suggested), but you'll still need a form module variable to supress subsequent runs.

Thomas Gonder       
41 days ago
Below I'll add a snip of the Status (yellow box) area of my forms. You can see some of the 17 procedures that ran at opening. Look at all the stuff that ran before Form_Current (013)! You can see the Form_Activate running twice (005 & 010). In reality, another 15 "helper" procedures ran, and a simple parameter change can show those procedures too.
Thomas Gonder       
41 days ago

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer Forum.


The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.

Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
My Account
My Courses
Lost Password
Student Databases
Change Email
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Customer Support
Web Site Tour
Consulting Services
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Video Tutorials
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Terms of Sale
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 7/19/2024 7:30:54 AM. PLT: 0s