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
|
Sub alain2()
Dim db As DAO.Database
Dim rc As DAO.Recordset
Dim rc2 As DAO.Recordset
Set db = Application.CurrentDb
Set rc = db.OpenRecordset("REQUETECDE", dbOpenDynaset)
Open "C:\tonFichier2.txt" For Output As #1
Print #1, "DEBTXT"
rc.MoveFirst
Do Until rc.EOF
Print #1, rc!NOM
Print #1, rc!ADRESSE
Print #1, rc!CP; rc!VILLE
Print #1, ' Insère une ligne vierge dans le fichier.
Print #1, "FINTXT" ' Écrit le texte dans le fichier.
Print #1, "PAIMEN"; Spc(5); rc!Mode_RGLMT; Spc(6); rc!DELAI_PAIEMENT
Print #1, "DATCDE"; Spc(5); rc!DATE_COMM; Spc(6); rc!DATE_LIVR
Print #1, "REFCDE"; Spc(5); rc!NUM_COM ' Écrit le texte dans le fichier.
Print #1, "REFLAB"; Spc(5); rc!REFLAB
Print #1, "AGELIV"; Spc(5); rc!CODCLI
Print #1, "DEBCDE" ' Écrit le texte dans le fichier.
Set rc2 = db.OpenRecordset("SELECT * FROM dbo_ARTICLE_COMM where num_com=" & rc!NUM_COM & "")
rc2.MoveFirst
Do Until rc2.EOF
Print #1, rc2!QTE_ART; rc2!CD_ART; Spc(6); rc2!REM
'Print #1, "FINCDE" ' Écrit le texte dans le fichier.
rc2.MoveNext
Loop
Print #1, "FINCDE" ' Écrit le texte dans le fichier.
rc.MoveNext
Loop
Close #1
End Sub |
Partager