AccessBlog.net

News, links, downloads, tips and tricks on Microsoft Access and related

About Me Search
Alex
Name:Alex Dybenko

Location:Moscow, Russia

Thursday, May 31, 2012

ImportXML method "Cannot establish connection to the server" error

My friend Peter, Access MVP, was recently puzzled by weird error, produced by simple line:

Application.ImportXML strPathFile, acStructureAndData

Runtime error was 31521 "Cannot establish connection to the server". There was no any network connection involved, strPathFile was as simple as "C:\Temp\Customer.xml". This xml file has been generated by:

Application.ExportXML acExportQuery, strQuery, _
strPathFile, , , , , acEmbedSchema

It turned out that Access Trust Center option "ActiveX Settings" was a source of such error, it was set to "Disable all controls without notification". Once it was changed to "Prompt me before enabling all controls …" – it works!

image

Thanks for sharing, Peter!

Labels: ,

2 Comments:

Anonymous Katerina said...

Hey,

I'm getting the same error, but in Access 2007 - and there's no ActiveX settings option in the trust center! Any ideas how to change (e.g., via registry)?

Access 2010 was recently installed and deinstalled, so I guess this caused the issue.

Many thanks!

1:41 AM  
Anonymous Peter Doering said...

Try following:

Start - Run - Regedit

Go to following key
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\Security

Double-click DisableAllActiveX and enter 0 as value.

I cannot test as I don't have Access 2007 anymore, therefore please let us know here whether it worked or not.

12:03 PM  

Post a Comment

<< Home