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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

QueryDefs - create local table

Status
Not open for further replies.

abenitez77

IS-IT--Management
Oct 18, 2007
147
US
I am creating a querydef in ms access to retrieve data from a multimillion rec table. I query the table to retrieve only thousands. I want to be able to create a table in ms access from the query returned by the querydef. How can I do this?

My code:
Set qODBC = d.CreateQueryDef(sqODBC, sql)
sConnectDAO = "ODBC;Description=ANP NON NATIVE CLIENT;DRIVER=SQL Server;SERVER=USATL02PRSQ70;Trusted_Connection=Yes ;DATABASE=A_and_P_STORES_DSD_2010_DSD_W"
qODBC.Connect = sConnectDAO
zODBC.sql sql
qODBC.Close
DoCmd.OpenQuery "qry_ANP_DSD_201007"
 
Dim strSQL As String
strSQL = "SELECT qry_ANP_DSD_201007.* INTO tblNew FROM qry_ANP_DSD_201007;"
CurrentDb.Execute strSQL

This was the answer i was looking for...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top