1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Sub import()
' import de ton fichier texte
DoCmd.TransferText acImportDelim, "nom_spécification_d'import", "importation", _
"chemin\fichier *.txt", True
' insertion des enregistrements retraités des doublons
' - 1 requête (qryUniques) qui ne garde que les nouveaux clients (non correspondance)
' - 1 requête ajout (qryInsert) qui insère dans ta table clients les données de qryUniques
DoCmd.RunSQL CurrentDb.QueryDefs("qryInsert").Sql
' effacement de ta table temporaire
DoCmd.RunSQL "DELETE FROM tblTemp"
' flag sur le fichier
FileCopy StrPath & StrFile, StrPath & StrFile & ".fait"
Kill StrPath & StrFile
End Sub |
Partager