xml output from an access table

rowantrimmer

New member
Local time
Today, 22:18
Joined
Apr 16, 2004
Messages
9
Hello,

I have written a simple query that just selects 3 fields from a table. I want to export the query results into an xml file. I have no problem in doing that but I notice that if a field is blank in the table it does not output the XML tag as in <\empty_tag>

Can someone please let me know how I can force the export to create the tag even if the field(s) is empty ? Do I need to write some sort of function. If so can anyone point me in the right direction ?

Also can someone let me know how I can automate a query to run that then exports the xml ?

Many thanks
 
what code are you using to export the text?
 
I have an application from which I was asked for SGML output. Here again there was the possibility of null values in a field.

The solution was simply to use a query to extract the data and have derived values. These derived values were simply the actual values with begin and end tags added.

derivedValue:"<Start Tag>" & [ActualValue] &"</Close Tag>" Null values give you <Start Tag></Close Tag>

Whoosed it all to a report, Used Office links to convert to straight txt file and heho a file that could be dropped straight into framemaker definition.

Len
 
I use ADO for this:

(Sample Code)
Code:
Public Sub SaveQryXML(stPathFileName As String)
    Dim rstTemp As ADODB.Recordset
    Dim cnnTemp As ADODB.Connection

        Set cnnTemp = CurrentProject.Connection
        Set rstTemp = New ADODB.Recordset
        rstTemp.Open "qryTest", cnnTemp, adOpenStatic, adLockReadOnly
            
        'Save Data in XML Format
        If Dir(stPathFileName) <> "" Then Kill stPathFileName
        rstTemp.Save stPathFileName, adPersistXML
        
        
        rstTemp.Close
        cnnTemp.Close
        Set rstTemp = Nothing
        Set cnnTemp = Nothing
         
Exit Sub
ErrorHandler:
    'Visual Basic Error
    MsgBox Err.Number, Err.Description
End Sub
 

Users who are viewing this thread

Back
Top Bottom