supponendo una tabella chiamata collegamento_tabelle contenente il solo campo nome_tabella sull'evento click di un pulsante inserisci:
codice:
dim rst As DAO.Recordset
dim sql as string
'apre recorset
sql = "SELECT T_VERSIONE_NUOVA.data, T_VERSIONE_NUOVA.versione FROM T_VERSIONE_NUOVA ORDER BY T_VERSIONE_NUOVA.data DESC"
Set rst = CurrentDb.OpenRecordset(sql)
If Not rst.BOF Then 'verivica se il recordset non è vuoto
'scorro il recorset dal primo all'ultimo record
With rst
.MoveFirst 'posizionati sul primo record
DoCmd.TransferDatabase acLink, "microsoft access", "F:\test2\database2.mdb", acTable, rst!nome_tabella, rst!nome_tabella, False
.MoveNext 'passa al prossimo record
Wend 'Not .EOF
End With 'Rst
else
msgbox "errore"
end if
'chiudi e azzera il recordset
rst.Close: Set rst = Nothing
supponendo una tabella chiamata collegamento_tabelle contenente i campi nome_tabella e path (dove in path verrà scritto il percorso completo del database compresa l'estensione es. F:\test2\database2.mdb) sull'evento click di un pulsante inserisci:
codice:
dim rst As DAO.Recordset
dim sql as string
'apre recorset
sql = "SELECT T_VERSIONE_NUOVA.data, T_VERSIONE_NUOVA.versione FROM T_VERSIONE_NUOVA ORDER BY T_VERSIONE_NUOVA.data DESC"
Set rst = CurrentDb.OpenRecordset(sql)
If Not rst.BOF Then 'verivica se il recordset non è vuoto
'scorro il recorset dal primo all'ultimo record
With rst
.MoveFirst 'posizionati sul primo record
DoCmd.TransferDatabase acLink, "microsoft access", rst!path, acTable, rst!nome_tabella, rst!nome_tabella, False
.MoveNext 'passa al prossimo record
Wend 'Not .EOF
End With 'Rst
else
msgbox "errore"
end if
'chiudi e azzera il recordset
rst.Close: Set rst = Nothing