how do I run a query on load of form?

shabbaranks

Registered User.
Local time
Today, 14:42
Joined
Oct 17, 2011
Messages
300
Hi all...

I have a query which checks a table to see if there are any new additions to it (the table is a linked table). Can anyone please tell me how I get the query to run on startup of the database? Does it require some VBA?

Thanks
 
Yes, it does require some VBA.
There are two events you can use for this purpose, Form_Open(can be cancelled) and Form_Load.

In the Form_Open event you can run a query and if you don't like what you see, cancel the form to open.
In the Form_Load event you can also run query.
The Form_Open event fires once and the Form_Load event fires each time the form receives focus.

HTH:D
 
... you can also run a Macro to run the query. But VBA gives you more control.

HTH:D
 
Hey,

Thanks for the replies, I managed to do it using

Code:
DoCmd.OpenQuery "ImportNewProjectsQuery"

Thanks again :)
 

Users who are viewing this thread

Back
Top Bottom