Ok. Do the import once, manually to create the table. Make sure you edit the column names on the new table to be something meaningfull.
Put a button on a form and put this code behind hit:
'Requires reference to Microsoft Office 12.0 Object Library.
Dim fDialog As Office.FileDialog
Dim varFile As Variant
'Set up the File Dialog.
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
'False, the user clicked Cancel.
.Filters.Clear
.Filters.Add "Excel Spreadsheets", "*.xls"
If .Show = True Then
For Each varFile In .SelectedItems
DoCmd.RunSQL "Delete * from TableName"
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel7, "TableName", varFile, False
Next
Else
MsgBox "You clicked Cancel in the file dialog box."
End If
End With
Hope this helps.
dartcoach
|