UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Xml And Access, Office 2007    
 
   
ConorS
post Mar 16 2012, 04:50 AM
Post #1

UtterAccess Ruler
Posts: 1,265
From: Northern Ireland (Newry)



Hi

My access system, i use access 07 with an sql backend. There is a company we are about to work in conjunction with, they have data that i'm looking to copy onto my access database (its been agreed). I've been told by them we can communicate via xml (i have to contact them and get more info off them). My understanding of xml is, data is formatted a certain way with data sitting in among tags which hold the field names. I've never used xml before.

Question, from my access database, can i hit a button on a form (vb code) that queries their database, and pulls data down directly into a table? Can this be done via access alone?

Or, is there something outside of access? Scripts or something.

I'd like it as integrated with my access system as possible. What are my options? And how do i achieve it? If anyone could point me in the right direction. Is xml and access difficult to program?

Regards

Conor

Go to the top of the page
 
+
arnelgp
post Mar 16 2012, 05:40 AM
Post #2

UtterAccess Ruler
Posts: 1,090



yes you can.
to export:

Application.ExportXML ObjectType:=acExportTable, DataSource:="Customers", _
DataTarget:="Customer Orders.xml", _
AdditionalData:=objOrderInfo

to import:

Application.ImportXML _
DataSource:="employees.xml", _
ImportOptions:=acStructureAndData

Or better yet find this function on Access help file for example and correct syntax.
Go to the top of the page
 
+
ConorS
post Mar 16 2012, 05:51 AM
Post #3

UtterAccess Ruler
Posts: 1,265
From: Northern Ireland (Newry)



ok, thanks. I'll take a look.
Go to the top of the page
 
+
jleach
post Mar 16 2012, 06:07 AM
Post #4

UtterAccess Editor
Posts: 6,711
From: Capital District, NY, USA



XML in general is pretty easy to get a grasp on. There's two types, as far as I recall: Narrative (corrective terminology?) and DOM (Data Object Model?).

In a narrative XML, we might see something like this:

CODE
This is some narrative text with XML embedded in it.  For example, we might say that the author <author name="John Doe" age=99>John Doe</author> wrote the article, and go on and on and on about it.


The DOM style is what we tend to see a lot more of and is a bit more straightfoward, IMO.

CODE
<Companies>
  <Company>
    <Name = "ABC" />
    <Country="USA" />
    <FederalID="00000000-00" />
  </Company>
  <Company>
    <Name ="DEF" />
    <Country="Canada" />
  </Company>
</Companies>


Another way to write the same thing:

CODE
<Companies>
  <Company Name="ABC" Country="USA" FederalID="0000000-00" />
  <Company Name="DEF" Country="Canada" />
</Companies>


or another way...
CODE
<Companies>
  <Company>
    <Name>ABC</Name>
    <Country>USA</Country>
    <FederalID>0000000-00</FederalID>
   </Company>
  <Company>
    <Name>DEF</Name>
    ....


In those examples, this would equate to an Access table name of Companies, and each Company element set would be a record, and each Name, Country, Federal ID would be a field.

There's a little more to it than that, but to give a general overview on how XML data can be related to database data, the above shows pretty well. One of the great things about XML is that we can give it a quick look and know almost exactly what's what (provided it's formatted well anyway - whitespace is optional so sometimes it's all crammed into a single line, which isn't nearly so nice to look at).

Each set of tags <Name>ABC</Name> is called an Element. Elements have an InnerText, in this case "ABC" (the stuff within the opening and closing Element tags). Data within an element definition is called an Attribute: <Company NameAttribute="ABC" CountryAttribute="USA" />

Not too bad, and that's probably 75% of what you need to know about the actual XML.

Cheers,
Go to the top of the page
 
+
ConorS
post Mar 16 2012, 07:25 AM
Post #5

UtterAccess Ruler
Posts: 1,265
From: Northern Ireland (Newry)



ok, thanks. I see how the data is laid out and i get it.

The scary part is importing/exporting it. I'm looking at this here trying to understand it..

http://office.microsoft.com/en-us/access-h...A001034560.aspx







Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 20th May 2013 - 02:00 AM