[AccessD] ExportXML CreateAdditionalData Named Argument Error

Bud Goss bgoss711 at ameritech.net
Thu Jul 15 14:15:22 CDT 2010


Thanks for the reply Charlotte 
  
The database I am testing with is the Northwind database 
  
It has an “Orders” table, an “Orders Detail” table, and a “Products” 
Table. It does mnot have a “Products Details” table. 
  
Also there is not a field named “Orders Details” 
  
The “Order ID” field of the “Orders” and “Orders Detail” tables 
relate these tables 
  
I simplified the code (see below) and tried a number of options to try to get a good compile (see below) but still get the Argument Not Found Error on all my compile attempts – no additional error information is provided. 
  
  
**** Charlotte’s reply starts 
Just a swag, but notice the differences between your Order Details lines

   .Add "Order Details"
>       objAD(Item:="Order Details").Add "Order Details Details"
>
and this:

      .Add "Products"
>       objAD(Item:="Products").Add "Product Details"
>       objAD(Item:="Products")(Item:="Product Details").Add _
>          "Product Details Details"

It looks to me like the code is adding an element to the xml that is
dependent on the initial element.  Do you actually have a field in the data called "Order Details"?  If so, then the "Order Details Details"
is assigned the doubled name to distinguish it from its parent
element.  Since you're getting a "named argument not found" error, I
would suspect that the item Order Details doesn't actually exist.  Is there any more information in the error message? 
**** Charlotte’s reply ends 
  
  
> simplified code for additional testing 
  
Private Sub ExportRelTables() 
  ' Purpose: Exports the Orders table as well as 
  ' a number of related databases to an XML file. 
  ' XSD and XSL files are also created. 
  
  Dim objAD As AdditionalData 
  
  ' Create the AdditionalData object. 
  Set objAD = Application.CreateAdditionalData 
  
  ' Add the related tables to the object. 
  With objAD 
     .Add "Order Details" 
     
     '##### Any of these lines these lines will cause the Named Argument Not Found Error 
     'objAD(Item:="Order Details").Add "Order Details Details" 
     'objAD(Item:="Order Details").Add "Order Details" 
     'objAD(Item:="Order ID").Add "Order Details Details" 
     'objAD(Item:="Order ID").Add "Order Details" 
     '##### 
      
     .Add "Customers" 
    
  End With 
  
  ' Export the Orders table along with the addtional data. 
  Application.ExportXML acExportTable, "Orders", _ 
      "C:\Orders.xml", "C:\OrdersSchema.xsd", _ 
      "C:\OrdersStyle.xsl", AdditionalData:=objAD 
End Sub


More information about the AccessD mailing list