Export tables to XML - how to get around an issue

jjh

Registered User.
Local time
, 20:57
Joined
Jun 7, 2006
Messages
32
HI:
I've managed to export multiple linked tables to XML via the Export feature in Access. In looking at the XLM that is generated, I notice that the data that corresponds to the key field contains the key that is autogenerated. If, for example, I look at the last table in the chain, and look at the foreign key field, it contains the key number of the table that it is linked to (as it should). My question is: is there a way to have this key value inserted in a relative (referential?) format rather than an absolute format?

For example, If the foreign key (e.g. #5) in table 'B' points to primary key 5 in table 'A', instead of having '5' in the field ID_my_key,

e.g.: <Table>A</Table>
<ID_my_key>5</ID_my_key>
I could have something like: TABLE A.5.
<Table>A</Table>
<ID_my_key>A.5</ID_my_key>

I am looking for this feature because I need to take a set of objects that are arranged in a hierarchial manner in the data base and import a subset of that information (keeping the hierarchial information in tact) into another tool.

I guess I could write some code to walk the structure and construct the references but that would be some additional work that I really don't have time for at the moment.
Any help/pointers on how to do this is appreciated.
-John
 
You could make a query based upon your table. Then in your Foreign Keys simply add "tablename." infront of the FK.
 
Clarification...

namliam said:
You could make a query based upon your table. Then in your Foreign Keys simply add "tablename." infront of the FK.

Thank you for the tip...I am not Access savy so I have to ask, "How do I do this?". I know how to do the query of the 'B' table (looking specifically at the FK field I suspect?). To what am I adding the 'tablename' to?
Thanks again
John
 
In the field (top row) of the query type something like:
AName: "TableA." & [YourID]

Aname will be your new column name (aka Alias), this CANNOT be the same as YourID or any other field you use in the query or table.
 

Users who are viewing this thread

Back
Top Bottom