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 41
|
Private Sub Form_Load()
Dim strSQL1 As String
Dim i As Integer
Dim cnAS400 As adodb.Connection
Dim RSImport As adodb.Recordset
Call Convertfile
Set cnAS400 = New Connection
Set RSImport = New Recordset
cnAS400.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & "c:\Projet ePlastic\" & _
";Extended Properties=""text;HDR=Yes;FMT=Delimited"""
strSQL1 = "select [SPLTNBR1], [SPPROD]," & _
"[SPRQTY], [SPLORD], [SPCUNM], [SPCDDT], [SPPRLN]" & _
"from [mfgdwh1.csv] where [SPPLTNAM] = 'FOS' and [SPYEAR] = 2006" & _
" and [SPWEEK] = 32 and [SPLTNBR1] <> 0"
RSImport.Open strSQL1, cnAS400, adOpenDynamic, adLockReadOnly, adCmdText
.../...
RSImport.Close
Set RSImport = Nothing
cnAS400.Close
Set cnAS400 = Nothing
End Sub
Sub Convertfile()
Dim File1, File2, a, b As String
File1 = "c:\Projet ePlastic\mfgdwh.csv"
File2 = "c:\Projet ePlastic\mfgdwh1.csv"
Open File1 For Input As #1
Open File2 For Output As #2
a = Input(LOF(1), #1)
b = Replace(a, ",", ";")
Print #2, b
Close #1
Close #2
End Sub |
Partager