hi i want my query to run byitself, when ever some one opens database. thats going to be update query, takes data from main table and puts that in table 2 and then delete duplicate values from table 2.
any help how to do that.
thanks in advance
You can create a form that opens invisible at the startup of your application. Run the query(s) in the On Open event of the form.
Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
You can do the execute. I believe you would need a reference set to a DAO library.
Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
This previous post is exactly what I am looking for, but I am not sure how to write the visual code. Below are a couple of events I have tried that are not working. Can someone please assist me how to correctly write it please? Currently I have an append query. Should I make it an update query before writing the code?
I have created a form based on the aquery "Count of OpenDeptCorp".
Private Sub Query1_Open(Cancel As Integer)
DoCmd.RunQuery "Count Of OpenDeptCorp"
End Sub
Private Sub Form_Open(Cancel As Integer)
DoCmd.RunCommand "Count Of OpenDeptCorp"
End Sub
An easier way to get the query to run whenever the database is started is simply to create an AutoExec macro which has one operation, to run the query. An AutoExec macro is just an ordinary macro with the specific name "AutoExec" - being named that way means it will automatically run when the database starts.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.