J’importe un fichier texte (.csv) avec spécification, comment faire pour
valider (avec VBA) l’importation si le fichier texte ne correspond pas aux
paramètres de la spécification?
Merci de votre aide
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Dante Huapaya
Voici un exemple de mon code:
Merci
Private Sub Command10_Click() On Error GoTo ErrTrap Dim filename As String
MsgBox "Selectionner votre fichier texte.", vbInformation, ("Mon application") filename = getCSVFile() If filename = "" Then Exit Sub DoCmd.SetWarnings False DoCmd.RunSQL ("DELETE * FROM MA_TABLE") DoCmd.TransferText acImportDelim, "MA_TABLE Import Specification", "MA_TABLE", filename, -1
MsgBox "Mon Fichier texte est importé!", vbInformation, ("Mon Application")
ExitPoint: On Error GoTo 0 Exit Sub ErrTrap: MsgBox Err.Number & " - " & Err.Description Resume ExitPoint End Sub
"Dante Huapaya" a écrit :
Bonjour à tous,
J’importe un fichier texte (.csv) avec spécification, comment faire pour valider (avec VBA) l’importation si le fichier texte ne correspond pas aux paramètres de la spécification? Merci de votre aide
Carlos Dante
Voici un exemple de mon code:
Merci
Private Sub Command10_Click()
On Error GoTo ErrTrap
Dim filename As String
MsgBox "Selectionner votre fichier texte.", vbInformation, ("Mon
application")
filename = getCSVFile()
If filename = "" Then Exit Sub
DoCmd.SetWarnings False
DoCmd.RunSQL ("DELETE * FROM MA_TABLE")
DoCmd.TransferText acImportDelim, "MA_TABLE Import Specification",
"MA_TABLE", filename, -1
MsgBox "Mon Fichier texte est importé!", vbInformation, ("Mon
Application")
ExitPoint:
On Error GoTo 0
Exit Sub
ErrTrap:
MsgBox Err.Number & " - " & Err.Description
Resume ExitPoint
End Sub
"Dante Huapaya" a écrit :
Bonjour à tous,
J’importe un fichier texte (.csv) avec spécification, comment faire pour
valider (avec VBA) l’importation si le fichier texte ne correspond pas aux
paramètres de la spécification?
Merci de votre aide
Private Sub Command10_Click() On Error GoTo ErrTrap Dim filename As String
MsgBox "Selectionner votre fichier texte.", vbInformation, ("Mon application") filename = getCSVFile() If filename = "" Then Exit Sub DoCmd.SetWarnings False DoCmd.RunSQL ("DELETE * FROM MA_TABLE") DoCmd.TransferText acImportDelim, "MA_TABLE Import Specification", "MA_TABLE", filename, -1
MsgBox "Mon Fichier texte est importé!", vbInformation, ("Mon Application")
ExitPoint: On Error GoTo 0 Exit Sub ErrTrap: MsgBox Err.Number & " - " & Err.Description Resume ExitPoint End Sub
"Dante Huapaya" a écrit :
Bonjour à tous,
J’importe un fichier texte (.csv) avec spécification, comment faire pour valider (avec VBA) l’importation si le fichier texte ne correspond pas aux paramètres de la spécification? Merci de votre aide