Article ID: 160875
Article Last Modified on 1/19/2007
Public Function TransferObject(Filename As String, _
objType As Integer, _
objName As String)
On Error GoTo TransferObject_Err
Dim accObj As New Access.Application
accObj.OpenCurrentDatabase Filename
accObj.DoCmd.DeleteObject objType, objName
accObj.CloseCurrentDatabase
Set accObj = Nothing
DoCmd.TransferDatabase acExport, _
"Microsoft Access", _
Filename, _
objType, objName, objName, False
MsgBox "Transferred Object: " & objName & _
" to database file " & Filename, _
vbInformation, "Test"
TransferObject_End:
Exit Function
TransferObject_Err:
MsgBox Err.Description, vbCritical, "Test"
Resume TransferObject_End
End Function
?TransferObject("Northwind2.mdb", acForm, "Orders")
Note that when the transfer is complete, you receive the message:Transferred Object: Orders to database file Northwind2.mdb
Function XferError()
DoCmd.TransferDatabase acExport, "Microsoft Access", _
"Northwind2.mdb", acForm, "Orders", "Orders", False
End Function
?XferError()
Macro: XferError Action
--------------------------------------
TransferDatabase
XferError Actions
----------------------------------
TransferDatabase
Transfer Type: Export
Database Type: Microsoft Access
Database Name: Northwind2.mdb
Object Type: Form
Source: Orders
Destination: Orders
Structure Only: No
Additional query words: IPF OutputTo xfer GPF msjet msjet35
Keywords: kbbug kberrmsg kbprogramming KB160875