Hi,

I am trying to output some data from sql db within excel to XML.

I am updating the sql db from the excel worksheet and then outputting the records from the db to xml.

I have used CDATA to parse html within xml but i can only get one record from the db although there are more.

Here is a piece of the code:

& "<BODY> <![CDATA[<head><meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"" />" _
& "<title>Untitled Document</title>" _
& "</head>" _
& "<body><table width=""100%"" border=""1"">" _
& "<tr><th scope=""col"">Supplier Branch</th>" _
& "<th scope=""col""><p>" & "]]>" & s1.Range("supplier") & "<![CDATA[</p></th>" _
& "</tr>" _
& "<td colspan=""5"">&nbsp;</td>" _
& "<tr>" _
& "<th scope=""col"">PO Number</th>" _
& "<th scope=""col"">" & "]]>" & rs1!PurchaseOrderNo & "<![CDATA[ </th>" _
& "<th scope=""col"">&nbsp;</th>" _
& "<th scope=""col"">Job ID</th>" _
& "<th scope=""col""><p>" & "]]>" & rs1!jobid & "<![CDATA[</p></th>" _
& "</tr>" _
& "<tr>" _
& "<td colspan=""5"">&nbsp;</td></tr>";
Print #f, "<tr>" _
& "<td>QTY</td>" _
& "<td>Part No</td>" _
& "<td>Description</td>" _
& "<td>Unit Price</td></tr>" _
& "<tr><td>" & rs1!quantity & "</td>" _
& "<td>" & rs1!PartNo & "</td>" _
& "<td>" & rs1!PartDescription & "</td>" _
& "<td>" & rs1!PartPrice & "</td>" _
& "<td>&nbsp;</td>" _
& "</tr>" _
& "</table>" _
& "</body>" & "]]>" & "</BODY>" _

Now there are more than 1 rows of quantity, PartNo, PartDescription and PartPrice. What i need is some sort of loop there to go through the recordset and output all records in a html table within xml which I have not been able to implement.

Any help will be highly appreciated.

Thanks.

I think this might be a nut cracker on VB4/5/6 forum. To ensure a quicker response or solution, try the web development forums, most of your code is HTML. I have asked the mods to have a look and see if they can place it for you.:)

yes but this is not web development it is excel vba

Very true, but html is VERY similar, which means the help you will receive will be much better than what you will receive here.

Thanks AndreRet.I will open a thread in there.

It was a pleasure.:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.