|
|

Transferring objects between two external Access databases
Whilst you can easily use the TransferDatabase method to import/export/link a table (or any other object) in the current database, if the object resides in one external database, and you wish to transfer it to another external database, then you could either import it from one database, and then export it to the second. Or else you could use something like this instead:
Sub sExportExternal(strDBFrom As String, strDBTo As String, strTableName As String)
On Error GoTo E_Handle
Dim objAccess As New Access.Application
With objAccess
.OpenCurrentDatabase (strDBFrom)
.DoCmd.TransferDatabase acExport, "Microsoft Access", strDBTo, acTable, strTableName, strTableName
.CloseCurrentDatabase
End With
sExit:
Exit Sub
E_Handle:
Select Case Err.Number
Case 3011
MsgBox "'" & strTableName & "' does not exist in '" & strDBFrom & "'", vbOKOnly, "Transfer cancelled"
Case 3044
MsgBox "'" & strDBTo & "' does not exist.", vbOKOnly, "Transfer cancelled"
Case 7866
MsgBox "'" & strDBFrom & "' does not exist.", vbOKOnly, "Transfer cancelled"
Case Else
MsgBox Err.Description, vbOKOnly + vbCritical, Err.Number
End Select
Resume sExit
End Sub
|
Top
HOME |
NEW |
TABLES |
QUERIES |
FORMS |
REPORTS |
GENERAL |
API |
DOWNLOADS |
TUTORIAL |
RESOURCES
E-MAIL
Copyright & Disclaimer
|
| |