Ryan said:
Can anyone tell me if there is a way that I can export data from
A2000 in XML format? Any websites? Forums? Books? Or would it be
easier to upgrade myself to 2002/2003?
Thank you for your time, Ryan
Going from RDMS to XML is actually pretty easy. It's going the other way
that's tough.
The following function will return an XML string provided a Table or Query
name. Al you have to do is write the result to a file using the file i/o
functions in Access/VBA. It creates what I call "Tabular XML" in that each
row of the table is represented with <row> </row> tags and each field is an
attribute. If you want the more traditional "Tag-per-field" format you
should be able to use this as a starting point and make the mods yourself.
For large tables you might need to do the file i/o in-line within this
function so you don't hit the size limit of a String variable.
Function XMLOutput(QryOrTblDef As String, Optional TableName As String) As
String
Dim MyDB As Database
Dim rst As Recordset
Dim fld As Field
Dim strText As String
Dim MyTableName As String
Set MyDB = CurrentDb
Set rst = MyDB.OpenRecordset(QryOrTblDef, dbOpenSnapshot)
strText = "<?xml version=""1.0""?>" & vbCrLf
If IsMissing(TableName) = True Then
MyTableName = QryOrTblDef
Else
MyTableName = TableName
End If
strText = strText & "<" & MyTableName & ">" & vbCrLf
With rst
Do Until .EOF
For Each fld In rst.Fields
strText = strText & " <" & fld.Name & ">" & _
Nz(rst(fld.Name), "NULL_VALUE") & "</" & fld.Name & ">" &
vbCrLf
Next
.MoveNext
Loop
End With
strText = strText & "</" & MyTableName & ">" & vbCrLf
Set rst = Nothing
Set MyDB = Nothing
XMLOutput = strText
End Function