Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > Forums > Developers
Back to Access Developer Forum    Comments List
Upload Images   Link   Email  
Form opens behind main form
Peter van Soest 
    
10 months 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 OP 
    
10 months ago

Kevin Robertson 
          
10 months 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 OP 
    
10 months ago

Peter van Soest OP 
    
10 months ago

Christopher Hankwembo 
  
10 months 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 OP 
    
10 months 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 
          
10 months 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 
          
10 months ago

Peter van Soest OP 
    
10 months ago
@kevin: I don't understand, where do I put this code?
Marc Lievens 
      
10 months 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 
      
10 months ago

Peter van Soest OP 
    
10 months ago
@Marc: Great! That did it, tnx!
Never use the timer event before....
Richard Rost 
          
10 months ago
See: Load Faster. Same trick. :)
Thomas Gonder 
       
10 months 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 
       
10 months 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 
       
10 months 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.
 

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

LinkedIn
Copyright 2025 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 4/26/2025 11:01:18 PM. PLT: 1s