event order on opening a form - access 2007

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Although the help screens say that the order should be open-load-current (as
it was in Access 2003), I have a project that I am trying to convert to 2007
where it would seem that the order is now load-current-open. I have
determined this by prints to the immediate window in the appropriate event
subroutines.

It would appear either the 2007 help screens are wrong or this is a serious
bug in Access 2007. Converting all my projects is going to be a nightmare!

Any help/suggestions would be appreciated. Thanks to any responders.
 
The actual order of the events has not been consistent, going back at least
10 years. It seems to depend what code you use in the event.

For example, you can block the opening of a form if its WhereCondition
filters it so that it has no records by placing this code in Form_Open:
If Me.RecordsetClone.RecordCount = 0 Then
Cancel = True
End If
However, a count of records would not be available unless the loading of
records had taken place. Similarly, the Current event can fire multiple
times while the Load and Open are working themselves out.
 
Having investigated further I can offer the following observations...

If I trap the code execution at the start of each event it would appear that
the event order is correct so my original post is in at least partially in
error. However, the prints to immediate window happen at the end of the event
procideures and it would seem that the Load and Current event procedures get
triggered and finish before the Open event procedure finishes! This does not
happen in 2003. How can I force finish of an event procedure before another
event gets triggered?

This is creating me problems because the load event actions get altered by
the open event and I really need things to happen in the right order.
 
Are you certain you're using the correct event for your code?

For the most part, the Open event should be limited to code that might end
up closing the form.
 
Back
Top