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
|
Public Function export(nomtable As String, nombase As String, chemin As String) As Boolean
If Right(chemin, 1) <> "\" Then ''''retraitement des chemins source et destination
chemin = chemin & "\"
End If
If Right(nombase, 4) <> ".mdb" Then
nombase = nombase & ".mdb"
End If
Dim tableObjet As TableDef
Dim app As Application
Dim name1, stable As String
name1 = chemin & nombase
'principalName =
Set app = CreateObject("Access.application")
app.OpenCurrentDatabase (name1)
For Each tableObjet In app.CurrentDb.TableDefs
stable = tableObjet.name
On Error Resume Next
If stable = nomtable Then
app.DoCmd.DeleteObject acTable, nomtable
' app.DoCmd.TransferDatabase acImport, "Microsft Access", stablechemin + nombase, acTable, name1, name1 ici est le Pb!!!
End If
Next tableObjet
On Error GoTo 0
CurrentDb.close
Set app = Nothing
End Function |
Partager