OVH Cloud OVH Cloud

Exportation d'une table

1 réponse
Avatar
Yves
Bonjour à tous,

Comment faire pour exporter une table

Voici mon programme


J'ouvre une base Access ou ODBC

If DB.State = adStateClosed Then

Select Case UCase(strBaseDeDonnéeType)
Case "ACCESS"
'Access
DB.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " &
strCheminBase & strNomBase
Case "ODBC"
'ODBC
DB.Open "Provider=MSDASQL.1;Persist Security Info=False;Data
Source=surgest;Initial Catalog=" &
strCheminBase & strNomBase
End Select

End If

Dim r As ADODB.Recordset
Set r = New ADODB.Recordset
'****************************************************************
'*********************************** Numérisation
'****************************************************************
On Error GoTo err_Numerisation
r.Open "SELECT * FROM [Numerisation]", DB, adOpenStatic,
adLockOptimistic

r.Close

Je voudrais exporter la table [Numerisation] comme exemple comment faire

1 réponse

Avatar
Yves
Bon j'ai trouver se moyen


'*****************************************
'*** Suppression de la table temp [épuration des dossiers]
'*****************************************
If Len(Définition) = 0 Then Exit Sub
r.Open "DROP TABLE [épuration des dossiers]", DB, adOpenStatic,
adLockOptimistic


'*****************************************
'*** Création de la table temp [épuration des dossiers]
'*****************************************
r.Open Définition, DB, adOpenStatic, adLockOptimistic


'*****************************************
'*** Exportation de la table temp [épuration des dossiers]
'*****************************************



'*****************************************
'*** Creer la nouvelle base épuration
'*****************************************
Dim strNomBaseNouvelle As String

strNomBaseNouvelle = "epurer.mdb"
CreateDatabaseX (strCheminBase & "epurer" & strNomBaseNouvelle)

'Creer la table
CreateTableEpuration strCheminBase & "epurer" & strNomBaseNouvelle,
"[tbDossier]"

r.Open "INSERT INTO tbDossier IN '" & strCheminBase & "epurer" &
strNomBaseNouvelle & "' SELECT [épuration des dossiers].* FROM [épuration
des dossiers]", DB, adOpenStatic, adLockOptimistic



"Yves" a écrit dans le message de
news:xRy8d.29079$N%
Bonjour à tous,

Comment faire pour exporter une table

Voici mon programme


J'ouvre une base Access ou ODBC

If DB.State = adStateClosed Then

Select Case UCase(strBaseDeDonnéeType)
Case "ACCESS"
'Access
DB.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " &
strCheminBase & strNomBase
Case "ODBC"
'ODBC
DB.Open "Provider=MSDASQL.1;Persist Security


Infoúlse;Data
Source=surgest;Initial Catalog=" &
strCheminBase & strNomBase
End Select

End If

Dim r As ADODB.Recordset
Set r = New ADODB.Recordset
'****************************************************************
'*********************************** Numérisation
'****************************************************************
On Error GoTo err_Numerisation
r.Open "SELECT * FROM [Numerisation]", DB, adOpenStatic,
adLockOptimistic

r.Close

Je voudrais exporter la table [Numerisation] comme exemple comment faire