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
| Declare Function ShowWindow Lib "User32" _
(ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Private Sub transfert()
Dim appOrigine As Access.Application
Dim accObject As AccessObject
Dim sw As Long
Dim strCheminBaseDistante
' Ouverture de la base distante en mode caché
strCheminBaseDistante = "G:\monDossier\maBase.accdb"
Set appOrigine = GetObject(strCheminBaseDistante)
sw = ShowWindow(appOrigine.hWndAccessApp, False)
' Transfert des objets sélectionnés
With appOrigine
For Each accObject In .CurrentData.AllQueries
.DoCmd.CopyObject , , acQuery, accObject.Name
Next accObject
.Quit
End With
Set appOrigine = Nothing
Set accObject = Nothing
End Sub |
Partager