[Visual basic] importation vers Access
Résolu
shoezman13
Messages postés
15
Date d'inscription
Statut
Membre
Dernière intervention
-
shoezman13 Messages postés 15 Date d'inscription Statut Membre Dernière intervention -
shoezman13 Messages postés 15 Date d'inscription Statut Membre Dernière intervention -
A voir également:
- [Visual basic] importation vers Access
- Visual basic - Télécharger - Langages
- Visual basic editor - Télécharger - Langages
- Visual petanque - Télécharger - Sport
- Microsoft 365 basic - Accueil - Microsoft Office
- Visual c++ 2019 - Guide
2 réponses
J'ai réussir a obtenir ce code mais il y a des problèmes là aussi :
Private Sub ImportCSV(sFileCSV As String, sTable As String)
Dim lFileCSV As Long
Dim sLine As String
Dim rsTable As Recordsets
Dim sField As String
Dim n As Integer
Dim m As Long
lFileCSV = FreeFile
Open sFileCSV For Input As #lFileCSV
Set rsTable = CurrenDB.OpenRecordset(sTable, dbOpenTable)
m = 0
Do
Line Input #lFileCSV, sLine
rsTable.AddNew
rsTable.Refresh
For n = 1 To Len(sLine)
If Mid(sLine, n, 1) <> ";" Then
sField = sField & Mid(sLine, n, 1)
Else
rsTable(m) = sField
sField = ""
m = m + 1
End If
If n = Len(sLine) Then
rsTable(m) = sField
sField = ""
m = 0
End If
Next n
rsTable.Update
Loop Until EOF(lFileCSV)
Close #lFileCSV
rsTable.Close
End Sub
Le AddNew ne passe pas apparement... comment je dois faire pour que ça marche s'il vous plait?
Si quelqu'un s'y connait, je le remercie déjà.
Private Sub ImportCSV(sFileCSV As String, sTable As String)
Dim lFileCSV As Long
Dim sLine As String
Dim rsTable As Recordsets
Dim sField As String
Dim n As Integer
Dim m As Long
lFileCSV = FreeFile
Open sFileCSV For Input As #lFileCSV
Set rsTable = CurrenDB.OpenRecordset(sTable, dbOpenTable)
m = 0
Do
Line Input #lFileCSV, sLine
rsTable.AddNew
rsTable.Refresh
For n = 1 To Len(sLine)
If Mid(sLine, n, 1) <> ";" Then
sField = sField & Mid(sLine, n, 1)
Else
rsTable(m) = sField
sField = ""
m = m + 1
End If
If n = Len(sLine) Then
rsTable(m) = sField
sField = ""
m = 0
End If
Next n
rsTable.Update
Loop Until EOF(lFileCSV)
Close #lFileCSV
rsTable.Close
End Sub
Le AddNew ne passe pas apparement... comment je dois faire pour que ça marche s'il vous plait?
Si quelqu'un s'y connait, je le remercie déjà.