1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| Private Sub cmdImportCognosCSV_Click()
Dim fs As FileDialog, laTable As DAO.TableDef
Dim nomEx As String
On Error GoTo Err_cmdImportCognos_Click
Set fs = Application.FileDialog(msoFileDialogFilePicker)
fs.Filters.Clear
fs.Filters.Add "CSV", "*.CSV"
If (fs.Show = -1) Then
For Each laTable In CurrentDb.TableDefs
If (laTable.Name = "CognosOriginalCSV") Then DoCmd.DeleteObject acTable, laTable.Name
Next
txtCheminFichier = fs.SelectedItems(1)
DoCmd.TransferText acExportDelim, , "CognosOriginalCSV", fs.SelectedItems(1), True
DoCmd.OpenQuery "DeleteDaten", acViewNormal, acAdd
DoCmd.OpenQuery "NeuenDaten", acViewNormal, acAdd
MsgBox "Import fertig ! ", vbInformation, "Servus"
End If
Set fs = Nothing
Exit_cmdImportCognos_Click:
Exit Sub
Err_cmdImportCognos_Click:
Exit Sub
Resume Exit_cmdImportCognos_Click
End Sub |
Partager