Automatic export to xml

radek225

Registered User.
Local time
Today, 01:41
Joined
Apr 4, 2013
Messages
307
I have back-end on LINUX, is there any possibilities to automatic export data to *xml? e.g. every 5 min. Maybe some code in vba which can be connected to system timer? I don't know just asking.
 
Have you looked at:
http://www.access-programmers.co.uk/forums/showthread.php?t=242332

Access has a Timer. Wont' go into all of the discussion on it. There are plenty found using the search: e.g.
http://www.access-programmers.co.uk/forums/showthread.php?t=265322&highlight=timer

You might consider creating a stand-alone Access project running the timer that Links to another Access DB (use linked tables). The timer would have to be running, then it could link to the external table, create an XML file.
 
You forgot to mention the point of exporting (what exactly?) in XML. What is it?
 
To write an Access database to XML so it can be simply printed in text format using VBA would be something like this. Sorry I don't have time to test it today.
Lets say you have a table that gets two names appended to a table and also need to send the data to an XML file.

Code:
NewClient.xml
<table> 
  <record> 
    <name>Susan</name> 
    <phone>123</phone> 
  <record> 
  </record> 
    <name>Tina</name> 
    <phone>654</phone> 
  </record> 
</table>
Code:
Option Compare Database ' in code module - must reference ADO
Option Explicit
Sub Main0()
  Dim NewClient_tabledef As New TableDef
  Dim NewClient_xml As Integer
  Dim NewClient_recordset As New ADODB.Recordset
  Dim NewClient_sql As String
  Set NewClient_tabledef = CurrentDb.CreateTableDef("NewClient")
  NewClient_tabledef.Fields.Append NewClient_tabledef.CreateField("name", dbText)
  NewClient_tabledef.Fields.Append NewClient_tabledef.CreateField("phone", dbText)
  On Error Resume Next
  CurrentDb.TableDefs.Append NewClient_tabledef 'add the table to the DB
  NewClient_recordset.Open "NewClient", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
  NewClient_recordset.AddNew
  NewClient_recordset.Fields("name").Value = "Susan"
  NewClient_recordset.Fields("phone").Value = "123"
  NewClient_recordset.Update
  NewClient_recordset.AddNew
  NewClient_recordset.Fields("name").Value = "Tina"
  NewClient_recordset.Fields("phone").Value = "654"
  NewClient_recordset.Update
  NewClient_recordset.Close
  Set NewClient_recordset = Nothing
  NewClient_xml = FreeFile()
  Open "NewClient.xml" For Output As NewClient_xml  ' name of the external table
  Print #NewClient_xml, "<table>"
  NewClient_recordset.Open "NewClient_table", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
  Do While Not NewClient_recordset.EOF
    Print #NewClient_xml, "  <record>"
    Print #NewClient_xml, "    <name>" & NewClient_recordset.Fields("name") & "</name>"
    Print #NewClient_xml, "    <phone>" & NewClient_recordset.Fields("phone") & "</phone>"
    Print #NewClient_xml, "  </record>"
    NewClient_recordset.MoveNext
  Loop
  Print #NewClient_xml, "</table>"
  Close NewClient_xml
  NewClient_recordset.Close
  Set NewClient_recordset = Nothing
End Sub

Won't promise this will work, but it should provide some ideas.
 

Users who are viewing this thread

Back
Top Bottom