How to Run an Update Query on open of access or a form

coffeeman

Registered User.
Local time
Today, 16:13
Joined
Oct 13, 2008
Messages
58
I have an update query that I need to be ran on open of access or a particular form in access that gets updated daily. I know I could get a command button to run the update query, but I was hoping to avoid this and just have it update automatically.

Thanks!
 
Open the form in design view and open the form's properties.

Scroll to the bottom of the various options and you should see several "On" events you can assign actions to.
OnLoad
OnClose
etx
 
I see where it is. Can you tell me the correct format to run an update query On Open in code?

Thanks!
 
You'll want to either create a macro or VBA script and then list it in the desired "On..." event.

Probably for a beginner, the easiest method is the create a Macro.
Open a new macro and study the design grid.
It's pretty straight forward what you'll need to do.
In the action column you'll want to select "OpenQuery"
Then in the lower portion (while the "OpenQuery" line is still selected), you'll want to specify the exact query in the "QueryName" field.

Then save it
Then designate it in the On... event
 
You are definitely helping me!

There is an issue I am running into. I created the Macro and called it "Macro Update Lot Code".

Here is the On Open Event for the form. As you can see, it is already running another procedure On Open. How and where should I write the code on here so that it will also run the Macro?

Private Sub Form_Open(Cancel As Integer)
Meter
End Sub

Thanks a bunch!
 
Never Mind!

I found that all I had to do is select the macro from a list and it runs the "On Load" event for the macro.

Thanks again Bilbo, will add to your rep.
 

Users who are viewing this thread

Back
Top Bottom