OnOpen V's OnActivate

Dave_cha

Registered User.
Local time
Today, 19:45
Joined
Nov 11, 2002
Messages
119
Has anyone ever seen this happen??

I'm running Access 2003 though I'm not sure how relevant that is.

The form in question has 3 list boxes. The first has it's rowsource defined in it's property box while I'm using an event procedure to select the first record in List Box 1 and then to populate the other two list boxes using .rowsource to specify the data source and the selected row in List box 1 to filter. The form is not bound to any data.

A simple enough procedure and nothing I haven't done before however this time around, when I use OnOpen to run the Event Procedure, the form freezes all the list boxes and any buttons on the form. OnActivate gets around this though I'd prefer to use OnOpen as there may be occasions where I don't want to run the procedure on activation.

Has anyone seen this and figured out what may cause it? There are no error messages to work with.

Rgds, Dave
 
Why don't you look at the descriptions of the events and when they run in the help files to help you determine which is the appropriate one - not the one you'd prefer?
 
Having used both options on numerous occasions, I would have thought either were appropriate leaving it down to preference based on circumstances.
I still cannot see why OnOpen would cause problems in this instance. The list boxes are populating however, as I said, the form contents then freeze.

Rgds, Dave
 
When you open a form there are five events that are triggered.

These are, in order:

  • Open
  • Load
  • Resize
  • Activate
  • Current

We can forget about the Current event here though. As for the others, these occur when:

  • Open: The form has been opened but no records have been loaded into it;
  • Load: The form has just had its records loaded into it;
  • Resize: The form has been resized to display on screen
  • Activate: The form is prepared for display and becomes the active window.

Now, as you have said your form has combos which have a RowSource which means that these records will need, also, to be loaded into the form. As you can see, when you use the Open event, the records aren't yet loaded in yet.

And that's why it works with Activate (after the Load event) and not the Open event.
 

Users who are viewing this thread

Back
Top Bottom