bonjour,
je n'arrive pas à exporter une table vers un fichier texte.
le programme plante à l'ouverture de la base "test" car celle ci est utilisée.
normale le code se trouve dans un module de la base ^^
comment dois je procéder ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Public Sub ecrittextedetable() Dim bd As Database Dim rst As Recordset Dim ligne As String Set bd = OpenDatabase("c:\test.mdb") Set rst = bd.OpenRecordset("client") If Not (rst.EOF And rst.BOF) Then Open "c:\client.txt" For Binary As #1 rst.MoveFirst ligne = "nom;prenom" Call EcritLigne(1, ligne) Do While Not rst.EOF ligne = rst("nom") & ";" & rst("prenom") Call EcritLigne(1, ligne) rst.MoveNext Loop Close #1 Else 'pas d'enregistrements End If Set rst = Nothing Set bd = Nothing End Sub Public Function EcritLigne(nfich As Integer, ligne As String) Dim count& Dim a$ count& = Len(ligne) For i& = 0 To count& Next i& a$ = Chr(13) + Chr(10) Put #nfich, , ligne Put #nfich, , a$ End Function
Partager