title: Microsoft Access - module to Upload txt file then import to table.
body: <p>I am new in Access been trying this for over 3days now. im tyingin to create a module or anything that when a press a button from a form the module will show a file dialog. get the .txt file and insert it into a table</p>
  
  <p>here is how far i have got</p>
  
  <pre><code>Private Sub FileUpload()
  
  'Requires reference to Microsoft Office 12.0 Object Library.
     Dim fDialog As Office.FileDialog
     Dim varFile As Variant
     Const MyFile = "TXT_Import_Spec" 'change to suit
  
  
  
     'Clear listbox contents.
     'Me.FileList.RowSource = ""
  
     'Set up the File Dialog.
     Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
     With fDialog
        'Allow user to make multiple selections in dialog box.
         .AllowMultiSelect = False
  
         'Set the title of the dialog box.
         .Title = "Please choose FM16 text files"
  
    'Clear out the current filters, and add our own.
    .Filters.Clear
    .Filters.Add ".txt FM16 Files", "*.TXT"
  
    .Show
  
  obJaces
        'Import Myfile
      DoCmd.TransferText acImportDelim, "TXT_Import_Spec", "DM1", "MyFile", False
  
  'Delete old records from Tbl_Import
  'CurrentDb.Execute "DELETE * FROM DM1"
  
  'Add new records to Tbl_Import
  CurrentDb.Execute "INSERT INTO DM1 SELECT * FROM MyFile WHERE MyFile.JobNo IN (SELECT MyFile.JobNo FROM MyFile LEFT JOIN Tbl_Import ON MyFile.JobNo = Tbl_Import.JobNo WHERE Tbl_Import.JobNo Is Null)"
  
  'Delete Myfile Table
  CurrentDb.Execute "DROP TABLE MyFile"
  
  
  End With
  
  End Sub
  </code></pre>
  
  <p>been a stress full week. will appreciate any help. </p>