none
TransferText runtime error 3011

    Question

  • The following VBA code fails when I try to export a query as HTML :

    DoCmd.TransferText acExportHTML, , "myQuery", "X:\export.html"

    Error is:

    Run-time error '3011'

    The Microsoft Office Access database engine could not find the object 'export.html'. Make sure that the object exists and that you spell its name and the path name correctly.

    Well it *does* exist, and I can't see any spelling mistakes. So obviously there is some other cause for this fault.

    Does anyone have some kind of clue what this might be?

    Friday, May 28, 2010 4:55 AM

All replies

  • Hallo, Dave,

    Dave Ballmer:

    > DoCmd.TransferText acExportHTML, , "myQuery", "X:\export.html"

    this code works here.

    Do you have write permission on X:\?

    Mark
    • Marked as answer by Dave Ballmer Sunday, May 30, 2010 11:58 PM
    • Unmarked as answer by Dave Ballmer Wednesday, June 02, 2010 1:15 AM
    Friday, May 28, 2010 10:25 AM
  • Thanks for the clue Mark, it now works fine when writing to the local drive C:\ but not to any mapped network drives, despite my having write permission there.

    I'm assuming that there is a policy setting somewhere, a firewall setting, or a security flaw in Access 2007 that prevents output to a network drive.

    The error only occurs when running macros (where the error occurs silently with no message) VBA code (with an error message), but works fine manually from the Access export menu.

    Do you know if this error has been reported to technet, and if the message will be changed to be more accurate?

    Sunday, May 30, 2010 11:58 PM
  • Hallo, Dave,

    Dave Ballmer:

    > Thanks for the clue Mark, it now works fine when writing
    > to the local drive C:\ but not to any mapped network drives,
    > despite my having write permission there.

    > I'm assuming that there is a policy setting somewhere,
    > a firewall setting, or a security flaw in Access 2007
    > that prevents output to a network drive.

    I suspected trust center causing the error, but I'm afraid
    I can't repro your error here.

    Could you add your network drive to trusted locations
    and then try again?

    Is your network drive a windows share in your domain?

    > The error only occurs when running macros (where the error
    > occurs silently with no message) VBA code (with an error
    > message), but works fine manually from the Access export menu.

    > Do you know if this error has been reported to technet,
    > and if the message will be changed to be more accurate?

    Well I'm not sure this is an error - maybe a security "feature"
    with an unreadable error message. You are right: in this case
    the message should be corrected.

    But first we should find the exact reason for this behaviour.

    Perhaps others reading this can try to repro as well?

    Mark
    Tuesday, June 01, 2010 8:18 AM
  • OK this is weird. I'm not sure if all network drives caused this fault previously, however they seem just fine when I test them today. I had originally added all the folders of X: to the Trust Centre before I ran the code, because that's where I'm using the database with macros and VBA. But in any case, the HTML now outputs to any network folder, trusted or not. Being ultra determined to find the cause, I was trying this out on several network folders until I noticed an HTML output file left over from my previous testing (which obviously must have been successful). But when I tried to output HTML with this filename, the 3011 error occurred and the file just disappeared! WTF?

    Now whenever I try to output with this particular bad file name, the error always occurs. But if I change the filename slightly then it outputs just fine. If I then rename that good file back to the bad filename, and try outputting with the bad filename again, then the file is deleted and the 3011 error is displayed.

    I'm beginning to suspect that this is a Windows Server error, or perhaps a Trust Centre artifact, and there is now an untrusted ghost file haunting the system that I can't banish. FYI the troublesome filename is: X:\AUTO\_David\AntennaAntenna Index.htm

    I've tried logging off and logging on again to no avail. And just now I got a "network access interrupted" error which is probably unrelated, but worth mentioning.

    Incidently, if I output an HTML file and then set it as read-only, the following error occurs if I output it again:

    Run-time error '3024':

    Could not find file ".

    It looks like the filename has been corrupted in the error report (it consists of a quote and a dot).

    Lastly, if I run a macro with the TransferText action (rather than VBA) the same error message is displayed, and then different error code appears in the "Action Failed" dialog afterwards: Error Number: 2950

    Wednesday, June 02, 2010 12:48 AM
  • Hallo, Dave,

    Dave Ballmer:

    > OK this is weird.

    indeed!

    > I'm not sure if all network drives caused this fault previously, however they seem just fine when I test them today. I had originally
    > added all the folders of X: to the Trust Centre before I ran the code, because that's where I'm using the database with macros and VBA. But in any case,
    > the HTML now outputs to any network folder, trusted or not. Being ultra determined to find the cause, I was trying this out on several network folders
    > until I noticed an HTML output file left over from my previous testing (which obviously must have been successful). But when I tried to output HTML
    > with this filename, the 3011 error occurred and the file just disappeared! WTF?

    Hmm. Perhaps you should check for existence and then delete the file
    before exporting.

    Mark
    Wednesday, June 02, 2010 8:50 AM
  • > Perhaps you should check for existence and then delete the file
    > before exporting.

    You have misunderstood the situation here. Deleting the file first makes no difference, the ghost file (or untrusted file or whatever it is) seems to remain on the system and it keeps blocking further HTML exports.

    Wednesday, June 02, 2010 11:24 PM
  • Hallo, Dave,

    Dave Ballmer:

    >> Perhaps you should check for existence and then delete the file
    >> before exporting.
    >
    > You have misunderstood the situation here.
    > Deleting the file first makes no difference,
    > the ghost file (or untrusted file or whatever it is)
    > seems to remain on the system and it keeps
    > blocking further HTML exports.

    oh, I see. Thanks for clarification.

    For further investigation perhaps you could run filemon and see what's
    happening exactly.

    Mark
    Thursday, June 03, 2010 12:07 PM
  • OK I found the culprit, after flapping around and trying various output folders on the local drive and network drive, copying the folder contents etc.

    By eliminating folder names as a factor, I discovered that it depends purely on the file name, and then discovered soon after that the broken folder contents must also be copied to the new folder to break exports to the new folder.

    Turns out that there is a leftover file called "schema.ini" that describes the export output fields, if I delete it then everything is fine. Looks like it was generated when I used the export wizard at some stage, and now it's screwing up all my VBA and macro exports.

    Is this some kind of expected feature, or a bug?

    Friday, June 04, 2010 4:20 AM
  • Answer: It's a bug! http://support.microsoft.com/kb/225987

    I already glanced at this while searching for a solution, and it didn't occur to me that "Word Merge Format" was in any way related to this HTML problem.

    This fault seems to have been around since Access 2000, I'm assuming now that it's been fixed for Word Merge format, but not for HTML format.

    Is this correct?

     

    • Proposed as answer by Prashant Sasi Monday, December 27, 2010 10:50 AM
    Friday, June 04, 2010 4:41 AM
  •  

    It is a bug of serious nature. I believe that it has got nothing to do access permissions, because all I am trying to do is an import ('Read" and I have that). The code is

    DoCmd.TransferText acImportDelim, "importSpec2", "PL-EquityTrading",filename, True

    where 'filename' is "ProfitAndLoss_Equity-Derivatives-NA_US_25112010.csv". I can consistently reproduce this

     

    Monday, December 27, 2010 10:54 AM
  • I agree with Prashanth.

    I can repro this consistently even on my laptop (as an administrator with full trust - I know unsafe but...)

    But here is the solution I found.

    First give it a try to Mark's solution described above.

    Next, try this: Make sure the column names in the export spec match the column names in the table the data is being exported from.

    It worked for me when I did this - at least for adExportFixed format. So I guess it is worth a try.

    HTH,

    Anurag

    Tuesday, December 20, 2011 8:52 PM
  • Anurag

    I know this is an old post, but in case you get back here again I wanted you to know you saved my bacon! I ran up against this same issue with a text file. When you mentioned the export spec it dawned on me that I had removed a column from the underlying query.

    Thank you so much for the advice.


    Bill Mosca
    www.thatlldoit.com
    http://tech.groups.yahoo.com/group/MS_Access_Professionals

    Friday, October 04, 2013 7:13 PM
  • I just came across this post while I was getting a 3011 error during a VBA TransferText command. I finally traced it to my export spec itself. One thing to keep in mind is that the field names in your table/query match those in the export spec exactly. Misspellings and missing/additional spaces can wreak havoc on the export and the 3011 error will not tell you where to look. Good luck out there.

    BSG

    Thursday, December 18, 2014 8:16 PM
  • I too found this post most helpful. The issue in my case was that I was re-using my export spec with a similar, but not identical, query.

    The export spec requires that the column headings are identical.

    Cheers to Anurag - thanks all!

    Thursday, May 04, 2017 5:31 PM