Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I run a query with code?? 4

Status
Not open for further replies.

egstatus

Programmer
Joined
Apr 14, 2005
Messages
143
Location
US
Hi all,
I have a query that I want to execute in an event procedure [When the user click on a command buttom], the querry is a make table querry. [Query name, qMakeMasterTableByYear]

Is this possible ??
If yes, how??

Thanks
 
Have a look at DoCmd.OpenQuery()

Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
you do realize that you don't have to create a new table, right? If you have a saved query you can use that in the FROM clause of another query:

Code:
SELECT SomeFields FROM TableName WHERE SomeCriteria = True

then another query that uses qry1:
Code:
SELECT Field1, Field2 FROM qry1


Leslie

In an open world there's no need for windows and gates
 
You may also consider the DoCmd.runSQL method ..

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Yep, several ways to skin a cat so to speak [smile]

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top