Results 1 to 11 of 11
  1. #1
    Join Date
    Jun 2007
    Posts
    65

    Unanswered: Error 2467 on exporting multiple tables to xml file

    Hello to all.
    I'm receiving the following error message:
    "2467: The expression you entered refers to an object that is closed or doesn't exit"

    This is the code i'm using:
    Code:
    Sub ExportDetails()
        Dim objOtherTbls As AdditionalData
        On Error GoTo ErrorHandle
        Set objOtherTbls = Application.CreateAdditionalData
        objOtherTbls.Add "BillingAddress"
        objOtherTbls.Add "Customer"
        objOtherTbls.Add "DocumentTotals"
        objOtherTbls.Add "Header"
        objOtherTbls.Add "Invoice"
        objOtherTbls.Add "Line"
        objOtherTbls.Add "OrderReferences"
        objOtherTbls.Add "Product"
        objOtherTbls.Add "SalesInvoices"
        objOtherTbls.Add "Settlement"
        objOtherTbls.Add "Tax"
        objOtherTbls.Add "TaxTableEntry"
        
        Application.ExportXML ObjectType:=acExportTable, _
        DataSource:="UF", DataTarget:="C:\Lixo\xpto.xml", _
        AdditionalData:=objOtherTbls
        
    Exit_Here:
        Exit Sub
    ErrorHandle:
        MsgBox Err.Number & ": " & Err.Description
        Resume Exit_Here
    End Sub
    I am a bit new to this.
    Can someone please explain what am i doing wrong?
    Thanks a lot for any help.
    Octavio

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    which line is reporting the error?

    I'm suspicious of
    Code:
    Application.ExportXML ObjectType:=acExportTable, _
        DataSource:="UF", DataTarget:="C:\Lixo\xpto.xml", _
        AdditionalData:=objOtherTbls
    AFAIK the Access line continuation symbol is & _ not _

    what happens if you try
    Code:
    Application.ExportXML ObjectType:=acExportTable, DataSource:="UF", DataTarget:="C:\Lixo\xpto.xml", AdditionalData:=objOtherTbls
    what is "UF", does it exist?
    I think the query has to be part of the querydefs collection to work, and it probably shouldn't be quoted
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jun 2007
    Posts
    65
    Thank you for answering.

    Code:
    Application.ExportXML ObjectType:=acExportTable, _
        DataSource:="UF", DataTarget:="C:\Lixo\xpto.xml", _
        AdditionalData:=objOtherTbls
    This is the line that reports the error. UF is the name of the database. This is VBA, so the continuation symbol is ok, i believe...

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    The combination of a space followed by an underscore ( _ ) is the correct line-continuation character, but you cannot use a line-continuation character to continue a line of code within a string expression, and I have the feeling that this is what the Access Gnomes consider you to be doing, here.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    Join Date
    Jun 2007
    Posts
    65
    Hello.
    Thanks for answering. I changed the code to a single line but i'm still getting the same error...
    What can this be?...

    Octavio

  6. #6
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    994
    Provided Answers: 2
    Code:
    Dim objOtherTbls As AdditionalData
    I might be missing something obvious here, but what is AdditionalData?
    10% of magic is knowing something that no-one else does. The rest is misdirection.

  7. #7
    Join Date
    Jun 2007
    Posts
    65
    Hi.

    It defines the contents of one of the Application.ExportXML parameters.

    Octavio

  8. #8
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    994
    Provided Answers: 2
    Is it a standard part of Excel? I'm still getting to grips with Excel 2010, but this does not look familiar.
    10% of magic is knowing something that no-one else does. The rest is misdirection.

  9. #9
    Join Date
    Jun 2007
    Posts
    65
    You an have a look on:

    Application.ExportXML Method (Access)

  10. #10
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    994
    Provided Answers: 2
    Ah, okay. Thanks.

    Given that your code looks a lot like the example in the above link, I can't see a reason for it to fail. I shall bow out of this thread now.
    10% of magic is knowing something that no-one else does. The rest is misdirection.

  11. #11
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    The Error Message for Error 2467 isn't

    "The expression you entered refers to an object that is closed or doesn't exit,"

    it is

    "The expression you entered refers to an object that is closed or doesn't exist!"

    As you said, AdditionalData is a Parameter of the ExportXML Method, but with

    Dim objOtherTbls As AdditionalData

    you are declaring objOtherTbls to be a Variable of the Datatype named AdditionalData, and there is no Datatype named AdditionalData! And since the Datatype named AdditionalData doesn't exist, I suspect that this is what Access is choking on.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •