title: DoCmd.RunSavedImportExport - Returns nothing when used on older computers, but works on newer computers. Ram Management?
body: <p>I currently have to load many SQL_Developer 'Loader' files into an Access DB on bi-weekly basis and the machine that does the import can be random. The code below works fine on a newer computer (i5 16gb ram, i7 16gb ram). For some reason though it will not load anything into the designated table after I call imexImport_LoaderFile a few times on a less than great computer (i3 8gb of ram, various laptops). It works for the first few and then as it goes down the list of calls to the imexImport_LoaderFile function it will just stop on a random one and not load the information into the access table. If I restart the computer it can get further down the list or imexImport_LoaderFile calls. The table it fails on is random, but after each subsequent try it gets less and less further down the list of imexImport_LoaderFile calls. I can then give up on the sad computer walk over to a newer model and it loads just fine from begging to end. I am assuming its a memory management issue, but I am clearing my objects in the function so I'm really stumped here. Any input at all would be amazing. Oh, and the source file has to be LOADER files which is why I am even using RunSavedImportExport.</p>
  
  <pre><code>Sub XYZ
  do things..
  
  ColNames = Array("a", "b", "c", "d", "e", "f", "g")
  CurrentTempTableMaxDate = imexImport_LoaderFile(FilePath, FileName, AccessTableNameTemp, AccessTableName, ColNames)
  If CurrentTempTableMaxDate &lt;= DBTablesMaxDate Then Err.Raise Number:=10002
  ColNames = Array("1", "2", "3", "4", "5", "6", "7")
  CurrentTempTableMaxDate = imexImport_LoaderFile(FilePath, FileName, AccessTableNameTemp, AccessTableName, ColNames)
  If CurrentTempTableMaxDate &lt;= DBTablesMaxDate Then Err.Raise Number:=10002
  ColNames = Array("a1", "b2", "c3", "d4", "e5", "f6", "g7")
  CurrentTempTableMaxDate = imexImport_LoaderFile(FilePath, FileName, AccessTableNameTemp, AccessTableName, ColNames)
  If CurrentTempTableMaxDate &lt;= DBTablesMaxDate Then Err.Raise Number:=10002
  
  do other things...
  end sub
  
  
  Public Function imexImport_LoaderFile(ByVal FilePath As String, ByVal FileName As String, ByVal AccessTempTableName As String, ByVal AccessTableName As String, ByVal ColNames As Variant) As Date
  Dim name_of_spec As String
  Dim imexObjs As Object
  Dim ColNumber As Integer
  Dim xml As String
  name_of_spec = "imspec" &amp; FileName
  On Error Resume Next
  If CurrentProject.ImportExportSpecifications.Count &gt; 0 Then
      If Err.Number = 0 Then
          Set imexObjs = CurrentProject.ImportExportSpecifications
          For Each imexObj In imexObjs
              If imexObj.NAME = name_of_spec Then imexObj.Delete
          Next
          Set imexObjs = Nothing
      End If
  End If
  
  If TableExist(AccessTempTableName) Then DoCmd.DeleteObject acTable = acDefault, AccessTempTableName
  LoaderFile_Cleanup (FilePath &amp; FileName)
  
  xml = ""
  xml = xml &amp; "&lt;?xml version=""1.0"" encoding=""utf-8"" ?&gt;" &amp; vbCrLf
  xml = xml &amp; "&lt;ImportExportSpecification Path=" &amp; Chr(34) &amp; FilePath &amp; FileName &amp; Chr(34) &amp; " xmlns=""urn:www.microsoft.com/office/access/imexspec""&gt;" &amp; vbCrLf
  xml = xml &amp; "   &lt;ImportText TextFormat=""Delimited"" FirstRowHasNames=""0"" FieldDelimiter=""|"" CodePage=""437"" Destination=" &amp; Chr(34) &amp; AccessTempTableName &amp; Chr(34) &amp; " &gt;" &amp; vbCrLf
  xml = xml &amp; "      &lt;DateFormat DateOrder=""MDY"" DateDelimiter=""/"" TimeDelimiter="":"" FourYearDates=""true"" DatesLeadingZeros=""false"" /&gt;" &amp; vbCrLf
  xml = xml &amp; "      &lt;NumberFormat DecimalSymbol=""."" /&gt;" &amp; vbCrLf
  xml = xml &amp; "           &lt;Columns PrimaryKey=""{none}""&gt;" &amp; vbCrLf
  
  For ColNumber = LBound(ColNames) To UBound(ColNames)
  xml = xml &amp; "                    &lt;Column Name=""Col" &amp; ColNumber + 1 &amp; """ FieldName=""" &amp; ColNames(ColNumber) &amp; """ Indexed=""NO""               SkipColumn=""false"" DataType=""Text""    Width=""12"" /&gt;" &amp; vbCrLf
  Next ColNumber
  
  xml = xml &amp; "         &lt;/Columns&gt;" &amp; vbCrLf
  xml = xml &amp; "     &lt;/ImportText&gt;" &amp; vbCrLf
  xml = xml &amp; "&lt;/ImportExportSpecification&gt;"
  '''debug.print xml
  CurrentProject.ImportExportSpecifications.Add name_of_spec, Trim(xml)
  DoCmd.RunSavedImportExport name_of_spec
  imexImport_LoaderFile = DMax("[MEGA_EFFDT]", "[" &amp; AccessTempTableName &amp; "]") 'Format(DMax("[EXPORTDATE]", "[" &amp; AccessTempTableName &amp; "]"), "mm/dd/yyyy") 'CDate(Int(DMax("[EXPORTDATE]", "[" &amp; AccessTempTableName &amp; "]")))
  ''debug.print imexImport_LoaderFile
  DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, AccessTempTableName, CID_BE_Dir &amp; AccessTempTableName, True
  
  CleanExitTask:
  Set imexObjs = Nothing
  End Function
  </code></pre>