Why does query execute before OnLoad event of Form

N

nigelf

I am trying to use a dialog box to capture parameter input for a form.

The form is based upon a query that takes the input from the dialog box and
uses it in the query.

However before I even get the OnLoad event for the form (where I open the
dialog box), the query is asking for my parameter input.

Does anybody out there know what the event order is when using queries in
forms?

cheers!
 
D

Douglas J. Steele

From the Help file:

"When you open a form based on an underlying query, Microsoft Access runs
the underlying query for the form before it runs the Open macro or event
procedure."

Also

"When you first open a form, the following events occur in this order:
Open => Load => Resize => Activate =>Current"
 
N

nigelf

Thanks Doug - I'm still finding my way around the documentation. I'm old
enough to remember the days I could leaf through a book for hours....

Anyway, is there a way I can stop the query from executing until I have
entered the parameters in th OnLoad event?

Thanks again for your help.....
Nigel
 
D

Douglas J. Steele

No, there isn't.

Can you open the dialog form first, fill in the fields and then have it open
the second form?
 
N

nigelf

Thanks Doug,

I can do all that - I'm just frustrated that something that I got
documentation for 15 months ago isn't working now! And I'm positive it was
but maybe I wasn't using queries. Hey Ho

Thanks again for your help.....

Nigel
 
D

Dirk Goldgar

nigelf said:
Thanks Doug - I'm still finding my way around the documentation. I'm old
enough to remember the days I could leaf through a book for hours....

Anyway, is there a way I can stop the query from executing until I have
entered the parameters in th OnLoad event?


Why not leave the form's recordsource blank in design view, but assign it in
the form's Open event after displaying your dialog?
 
D

Douglas J. Steele

Dirk Goldgar said:
Why not leave the form's recordsource blank in design view, but assign it
in the form's Open event after displaying your dialog?

D'oh! I do that all the time. Why didn't I think to mention it?

Thanks, Dirk.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top