Arthur Fuller
artful at rogers.com
Tue Feb 11 11:41:45 CST 2003
I typically use a pair of recordsets for this sort of work. The following code is snipped out of one of my apps. You'll have to do some replaces here and there, but it should be enough to give you the idea. <code> Dim rstSource As New ADODB.Recordset Dim rstTarget As New ADODB.Recordset Dim strSourceSQL As String Dim lngPK As Long strSourceSQL = "Select * from myTable " 'adjust here rstSource.Open strSourceSQL, CurrentProject.Connection, _ CursorType:=adOpenForwardOnly, LockType:=adLockReadOnly rstTarget.Open "MyTempTable", CurrentProject.Connection, _ CursorType:=adOpenDynamic, LockType:=adLockOptimistic Do While rstSource.EOF = False rstTarget.AddNew rstTarget("Column1_Name") = rstSource("Column1_Name") rstTarget("Column2_Name") = rstSource("Column2_Name") rstTarget.Update rstSource.MoveNext Loop rstSource.Close rstTarget.Close Set rstSource = Nothing Set rstTarget = Nothing </code> Actually I wrote a little tool that generates this sort of code for any table, just to save on the typing. After running the loop, all you have to do is delete the old table, then rename the new table. Arthur -----Original Message----- From: accessd-admin at databaseadvisors.com [mailto:accessd-admin at databaseadvisors.com] On Behalf Of Paul Black Sent: February 11, 2003 11:22 AM To: accessd at databaseadvisors.com Subject: RE: [AccessD] Can I pack / compact dbf files with Access 97? How would I code this so lets say I started off with tblStuff and replaced it with tblStuff where tblStuff is a linked dbf table not a native Access table? I have no idea how to do that. Thanks Paul