Home  |  About  |   Search   

What's New
Table Of Contents
Credits
Netiquette
10 Commandments 
Bugs
Tables
Queries
Forms
Reports
Modules
APIs
Strings
Date/Time
General
Downloads
Resources
Search
Feedback
mvps.org

RunCommand Constants

Terms of Use


 

Bugs: TransferDatabase Causes Page Fault If Object Exists

Author(s)
Dev Ashish
 

You may experience a GPF when trying to export an object to another database by using TransferDatabase method.  This page fault occurs if the destination object (any valid Access object type) already exists.

    The only solution at present is to use Automation to start a new Access instance and delete the destination object before issuing the TransferDatabase command.

    160875:  TransferDatabase causes page fault if object exists.

    This code has been copied from the aforementioned Support article.

'****** Code Start ********
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
'****** Code End ********

1998-2009, Dev Ashish & Arvin Meyer, All rights reserved. Optimized for Microsoft Internet Explorer