locked
Access 2007 VBA runs application.ExportXML crashes Access under Windows 7 RRS feed

  • Question

  • I moved an Access 2007 database over to a machine which is running Windows 7.  One line of code in VBA runs Application.ExportXML to export a table to XML.  It consistently crashes the Access database.   Works fine under XP Pro, XP Home, and Vista.    Any thoughts?
    • Moved by Jie Bao Tuesday, May 10, 2011 10:24 AM (From:Application Compatibility for Windows Development)
    Sunday, May 8, 2011 10:36 PM

Answers

  • Hi Fun4U2

    Fun4U2 wrote:

    Here is the VBA code:

    Application.ExportXML ObjectType:=acExportTable, _

    DataSource:="AnswerForForms", _

    DataTarget:="C:\AnswerForForms.xml", _

    SchemaTarget:="C:\AnswerForForms.xsd"



    The code was initially developed on XP Pro. Still works fine on all XP
    machines. It now crashes the entire database under Windows 7


    Error reads “Microsoft Office Access has stopped working:

    Shouldn't crash, actually. But I wouldn't be surprised if this doesn't work. In WinXP you may not have access to the root of the drive C:. Even if you are administrator you may not have access in the user's context (if UAC is turned on)

    Try a folder of this user, for example %temp%\AnswerForForms.xml or %homepath%\answerForForms.xml

    HTH
    Henry

    • Marked as answer by Bruce Song Thursday, May 19, 2011 9:15 AM
    Monday, May 16, 2011 11:43 AM
  • As henry said, in Windows 7 (not XP, Henry make a mistake), our code may not have the permission to access the C:\ drive, even though you are an administrator. So you could "Turn Off" the UAC (it is not recommended), or run your code as Administrator. Or you could use an User Folder "D:\" or "User's Desktop, User's Data Folder" to store the data.

    Sincerely,


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Bruce Song Thursday, May 19, 2011 9:15 AM
    Monday, May 16, 2011 3:49 PM

All replies

  • What is the error can you get?  Could you please show some VBA code here. And I help you to move it to the VBA forum, we may get a answer there.

    Thanks.

    Sincerely,


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, May 10, 2011 10:23 AM
  •  

    Here is the VBA code:

    Application.ExportXML ObjectType:=acExportTable, _

                            DataSource:="AnswerForForms", _

                            DataTarget:="C:\AnswerForForms.xml", _

                            SchemaTarget:="C:\AnswerForForms.xsd"

     

    The code was initially developed on XP Pro.  Still works fine on all XP machines.   It now crashes the entire database under Windows 7

    Error reads “Microsoft Office Access has stopped working:

    Details are:

     

    Problem signature:

      Problem Event Name:           APPCRASH

      Application Name:    MSACCESS.EXE

      Application Version: 12.0.6535.5005

      Application Timestamp:        4bf5c550

      Fault Module Name: ACECORE.DLL

      Fault Module Version:          14.0.4760.1000

      Fault Module Timestamp:     4ba8fda7

      Exception Code:       c0000005

      Exception Offset:     00008d2f

      OS Version:  6.1.7601.2.1.0.256.48

      Locale ID:     1033

     

    Additional information about the problem:

      LCID:           1033

      Brand:           Office12Crash

      skulcid:          1033

     


    Saturday, May 14, 2011 3:22 PM
  • Hi Fun4U2

    Fun4U2 wrote:

    Here is the VBA code:

    Application.ExportXML ObjectType:=acExportTable, _

    DataSource:="AnswerForForms", _

    DataTarget:="C:\AnswerForForms.xml", _

    SchemaTarget:="C:\AnswerForForms.xsd"



    The code was initially developed on XP Pro. Still works fine on all XP
    machines. It now crashes the entire database under Windows 7


    Error reads “Microsoft Office Access has stopped working:

    Shouldn't crash, actually. But I wouldn't be surprised if this doesn't work. In WinXP you may not have access to the root of the drive C:. Even if you are administrator you may not have access in the user's context (if UAC is turned on)

    Try a folder of this user, for example %temp%\AnswerForForms.xml or %homepath%\answerForForms.xml

    HTH
    Henry

    • Marked as answer by Bruce Song Thursday, May 19, 2011 9:15 AM
    Monday, May 16, 2011 11:43 AM
  • As henry said, in Windows 7 (not XP, Henry make a mistake), our code may not have the permission to access the C:\ drive, even though you are an administrator. So you could "Turn Off" the UAC (it is not recommended), or run your code as Administrator. Or you could use an User Folder "D:\" or "User's Desktop, User's Data Folder" to store the data.

    Sincerely,


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Bruce Song Thursday, May 19, 2011 9:15 AM
    Monday, May 16, 2011 3:49 PM
  • Hi Bob

    That was indeed a typo. Of course in WinXP it would work, but not in Win7. But anyhow Access should return an access denied message instead of crashing. Seems to me to be something that should be filed as possible bug in Access.

    Henry

    Tuesday, May 17, 2011 2:41 AM
  • Hmm, not a good user experience. Thanks for this feedback.  We could submit the feedbacks on the Microsoft Connect site.

    Sincerely,


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, May 19, 2011 9:13 AM
  • Bob Bao wrote:

    We could submit the feedbacks on the Microsoft Connect site
    <https://connect.microsoft.com/>.

    Can you do, pls? You are MS employee. They probably will not listen to me, not an MVP anymore ;-)

    Thanks
    Henry

    Friday, May 20, 2011 4:37 AM
  • Fun4U2 Back with an update -- just in case someone runs across this post with the same problem in the future. 

     

    The problem laid somewhere deep in the code.  Apparently there was some element of corruption in the DB to begin with.  I solved the problem by creating a new DB in Access 2007 using Windows 7.  Linked all of my references back into the new DB, imported all of the tables, forms, etc. from the old DB into the new DB, compiled the code (had to fix a few bugs) and she runs like a charm.  An added benefit is the size of the DB was dramatically reduced.

     

    Thanks to all who replied.  You are what makes the world go around. 

    Sunday, July 31, 2011 8:02 PM