export to xml

edo janssen

Registered User.
Local time
Today, 11:03
Joined
Oct 29, 2010
Messages
16
I build a module for creating invoices by batch. Now I want to automate the process to enter the invoices into our accountingprogram. Therefor I'm creating an xml-file. However I cannot get it right to put multiple invoices in it.

The code so far:
Code:
'Private Sub Command33_Click() 
Sub MaakXML1970() 
 
DoCmd.OpenQuery "qryTestXML" 
'Export data to text file 
  
Dim MyDB As Database 
Dim MyRS As Recordset 
Dim fld As Field 
Dim strText As String 
Dim MyTableName As String 
Dim QryOrTblDef As String 
QryOrTblDef = "qryTestXML" 
Set MyDB = CurrentDb 
Set MyRS = MyDB.OpenRecordset(QryOrTblDef) 
  
Open "Verkoopboek2.xml" For Output Shared As #1 
  
'------------------------------------KOPREGEL------------------------------------ 
Print #1, "<?xml version=""1.0"" encoding=""UTF-8""?>" 
Print #1, "<eExact  xmlns:xsi=""http://www.w3.org/2001.XMLSchema-instance""  xsi:noNamespaceSchemaLocation=""eExact-Schema.xsd"">" 
Print #1, "<GLEntries>" 
Print #1, "  <GLEntry>" 
Print #1, "     <Description>" & Chr(34) & MyRS!Faktuurnummer & Chr(34) & "</Description>" 
Print #1, "     <Date>" & Chr(34) & MyRS!FactuurDatum1 & Chr(34) & "</Date>" 
Print #1, "     <DocumentDate>" & Chr(34) & MyRS!FactuurDatum1 & Chr(34) & "</DocumentDate>" 
Print #1, "     <Journal code=" & Chr(34) & "70" &  Chr(34) & Chr(10) & "type=" & Chr(34) & "V" &  Chr(34) & ">" 
Print #1, "         <GLAccount code=" & Chr(34) & "1970"  & Chr(34) & Chr(10) & "type=" & Chr(34) & "B" &  Chr(34) & Chr(10) & "side=" & Chr(34) & "D" &  Chr(34); ">" 
Print #1, "             <Description>" & Chr(34) &  "Debiteuren ambachten" & Chr(34) & "</Description>" 
Print #1, "             <PercentageVATNonDeductable>" &  Chr(34) & "0" & Chr(34) &  "</PercentageVATNonDeductable>" 
Print #1, "         </GLAccount>" 
Print #1, "     </Journal>" 
'------------------------------------SUBREGELS------------------------------------ 
With MyRS 
Do Until .EOF 
Print #1, "     <FinEntryLine number=" & Chr(34) & "1" &  Chr(34) & ">"; Chr(10) & "type=" & Chr(34) & "N"  & Chr(34) & Chr(10) & "subtype=" & Chr(34) & "K"  & Chr(34) & Chr(10) & "transactiontype=" & Chr(34) &  "0" & Chr(34) & ">" 
Print #1, "         <FinYear number=" & Chr(34) & MyRS!Boekjaar & Chr(34) & "/>" 
Print #1, "     </FinEntryLine>" 
.MoveNext 
Loop 
End With 
'Print #1, "</GLEntry>" 
'Print #1, "</GLEntries>" 
'Print #1, "</eExact>" 
'Close #1 
MyRS.Close 
Set MyRS = Nothing 
Set MyDB = Nothing 
Print #1, "</GLEntry>" 
Print #1, "</GLEntries>" 
Print #1, "</eExact>" 
Close #1 
 
End Sub

The output I get:
Code:
  <?xml version="1.0" encoding="UTF-8" ?>  
- <eExact xmlns:xsi="http://www.w3.org/2001.XMLSchema-instance" xsi:noNamespaceSchemaLocation="eExact-Schema.xsd"> 
- <GLEntries> 
- <GLEntry> 
  <Description>"V_2010_00001"</Description>  
  <Date>"08-11-2010"</Date>  
  <DocumentDate>"08-11-2010"</DocumentDate>  
- <Journal code="70" type="V"> 
- <GLAccount code="1970" type="B" side="D"> 
  <Description>"Debiteuren ambachten"</Description>  
  <PercentageVATNonDeductable>"0"</PercentageVATNonDeductable>  
  </GLAccount> 
  </Journal> 
- <FinEntryLine number="1"> 
  type="N" subtype="K" transactiontype="0">  
  <FinYear number="2010" />  
  </FinEntryLine> 
- <FinEntryLine number="1"> 
  type="N" subtype="K" transactiontype="0">  
  <FinYear number="2010" />  
  </FinEntryLine> 
- <FinEntryLine number="1"> 
  type="N" subtype="K" transactiontype="0">  
  <FinYear number="2010" />  
  </FinEntryLine> 
- <FinEntryLine number="1"> 
  type="N" subtype="K" transactiontype="0">  
  <FinYear number="2010" />  
  </FinEntryLine> 
- <FinEntryLine number="1"> 
  type="N" subtype="K" transactiontype="0">  
  <FinYear number="2010" />  
  </FinEntryLine> 
- <FinEntryLine number="1"> 
  type="N" subtype="K" transactiontype="0">  
  <FinYear number="2010" />  
  </FinEntryLine> 
- <FinEntryLine number="1"> 
  type="N" subtype="K" transactiontype="0">  
  <FinYear number="2010" />  
  </FinEntryLine> 
- <FinEntryLine number="1"> 
  type="N" subtype="K" transactiontype="0">  
  <FinYear number="2010" />  
  </FinEntryLine> 
- <FinEntryLine number="1"> 
  type="N" subtype="K" transactiontype="0">  
  <FinYear number="2010" />  
  </FinEntryLine> 
- <FinEntryLine number="1"> 
  type="N" subtype="K" transactiontype="0">  
  <FinYear number="2010" />  
  </FinEntryLine> 
- <FinEntryLine number="1"> 
  type="N" subtype="K" transactiontype="0">  
  <FinYear number="2010" />  
  </FinEntryLine> 
- <FinEntryLine number="1"> 
  type="N" subtype="K" transactiontype="0">  
  <FinYear number="2010" />  
  </FinEntryLine> 
- <FinEntryLine number="1"> 
  type="N" subtype="K" transactiontype="0">  
  <FinYear number="2010" />  
  </FinEntryLine> 
- <FinEntryLine number="1"> 
  type="N" subtype="K" transactiontype="0">  
  <FinYear number="2010" />  
  </FinEntryLine> 
- <FinEntryLine number="1"> 
  type="N" subtype="K" transactiontype="0">  
  <FinYear number="2010" />  
  </FinEntryLine> 
- <FinEntryLine number="1"> 
  type="N" subtype="K" transactiontype="0">  
  <FinYear number="2010" />  
  </FinEntryLine> 
- <FinEntryLine number="1"> 
  type="N" subtype="K" transactiontype="0">  
  <FinYear number="2010" />  
  </FinEntryLine> 
- <FinEntryLine number="1"> 
  type="N" subtype="K" transactiontype="0">  
  <FinYear number="2010" />  
  </FinEntryLine> 
  </GLEntry> 
  </GLEntries> 
  </eExact>

The output I would like to have is in the zipfile attached to this message. Who can help me out?
 

Attachments

Users who are viewing this thread

Back
Top Bottom