Darren - Active Billing
darren at activebilling.com.au
Tue Oct 13 05:55:45 CDT 2009
Hi Max This looks promising - How would you get it to connect to SQL server on table X and then populate a local Access Table with all the records from table X? Many thanks Darren -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo Sent: Tuesday, 13 October 2009 3:40 AM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Insert Into 101 As far as I understand the problem, this works ok for me. Max Sub AppendRecsFromQuery() Dim dbs As DAO.Database, rst As DAO.Recordset Dim sql As String, qdf As DAO.QueryDef Set dbs = CurrentDb sql = "Drop table _TestA" dbs.Execute (sql) sql = "Create Table _TestA (FirstName text, Surname Text, PersonID long)" dbs.Execute (sql) sql = "Drop Table _TestQ" dbs.Execute sql sql = "Select firstname,surname,PersonID from mcmPeople Where PersonID < 1000" Set qdf = dbs.CreateQueryDef("_TestQ", sql) Set rst = dbs.OpenRecordset(qdf.Name, dbOpenSnapshot) sql = "insert into _TestA " & qdf.sql dbs.Execute sql End Sub -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com