' Create a HTML table from a recordset'' set the TableAttribs argument to a suitable value' (eg "BORDER=1") to modify the table's standard layout' you should omit the NullValues argument if you want that null' values are displayed in empty cells' set the ShowFieldNames to True to display field names in boldface' set the IncludeWhiteSpace argument to True if you want to produce' a longer and less efficient (but more readable) outputFunction RecordsetToHTMLTable(rs As ADODB.Recordset, _ ByVal TableAttribs As String, Optional ByVal NullValues As String = _ " ", Optional ByVal ShowFieldNames As Boolean, _ Optional ByVal IncludeWhiteSpace As Boolean) As String Dim res As String Dim fld As ADODB.Field Dim tmp As String Dim lf As String, tb As String ' fill these variables only if spaces are to be kept If IncludeWhiteSpace Then lf = vbCrLf tb = vbTab End If ' prepare the tag res = "" & lf ' show field names, if required If ShowFieldNames Then res = res & tb & "" & lf For Each fld In rs.Fields res = res & tb & tb & "" & fld.Name & " " & lf Next res = res & tb & "" & lf End If ' get all the records in a semi-formatted string tmp = rs.GetString(, , "" & lf & tb & tb & "", _ " " & lf & tb & "" & lf & tb & "" & lf & tb & tb & "", _ NullValues) ' strip what has been appended to the last cell of the last row tmp = Left$(tmp, Len(tmp) - Len(lf & tb & " " & lf & tb & tb & "")) ' add opening tags to the first cell of the first row of the table ' and complete the table RecordsetToHTMLTable = res & tb & " " & lf & tb & tb & "" & tmp & lf _ & "
" End Function
Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.
Related Posts
About Our Editorial Process
At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.
See our full editorial policy.
Evvy Raises $40 Million for Women’s Health
Sumit Kumar
September 25, 2026
4:57 PM
Prince Harry Warns of AI Chatbot Risks
Deanna Ritchie
September 25, 2026
4:33 PM
Amazon Adds AI Agents for Sellers
Sumit Kumar
September 25, 2026
4:19 PM
Claude Opus 5.5: Lower Pricing and Higher Coding Benchmarks Explained
Johannah Lopez
September 25, 2026
3:55 PM
US Housing Market Tilts Toward Buyers
Steve Gickling
September 25, 2026
3:25 PM
Virtual Character Sidesteps Politics in Movie Promotion
Steve Gickling
September 25, 2026
2:09 PM
Google Safety Founder Urges AI Slowdown
Kirstie Sands
September 25, 2026
10:23 AM
C2C Links AI Models Through KV Caches
Rashan Dixon
September 25, 2026
9:29 AM
The SaaS Metrics That Actually Predict Growth
Rashan Dixon
September 25, 2026
8:00 AM
Researchers Claim Hacks of Meta and Slack
Deanna Ritchie
September 24, 2026
5:04 PM
More Americans Turn to Chatbots for Support
Sumit Kumar
September 24, 2026
4:38 PM
AI Leaders Clash Over Development Pace
Rashan Dixon
September 24, 2026
4:31 PM
What Is Karmada? The Kubernetes Multi-Cluster Tool Explained
Priya Nandakumar
September 24, 2026
1:32 PM
Apple Faces Leadership Test Under John Ternus
Rashan Dixon
September 24, 2026
12:48 PM
Senator Urges Independent Tests for Frontier AI
Kirstie Sands
September 24, 2026
9:39 AM
Silent Data Change Skews Audience Counts
Steve Gickling
September 24, 2026
9:15 AM
Revenant Ventures Closes $78.5 Million Debut Fund
Sumit Kumar
September 24, 2026
9:11 AM
How to Become a Software Engineer Without a CS Degree
Rashan Dixon
September 24, 2026
8:00 AM
Opus 5.5 Won the Latest AI Contest
Joe Rothwell
September 24, 2026
7:51 AM
Enterprises Struggle to Control AI Agent Costs
Steve Gickling
September 23, 2026
4:35 PM
Ohio Data Center Boom Pressures Residents
Sumit Kumar
September 23, 2026
3:29 PM
Venture Gains Lift San Francisco Pension Returns
Sumit Kumar
September 23, 2026
1:43 PM
Walter Torous to Lead MIT Real Estate Center
Deanna Ritchie
September 23, 2026
12:41 PM
XTU Targets Budget Action-Camera Buyers
Rashan Dixon
September 23, 2026
12:32 PM
Scientists Create Touch Technology With Printer Toner
Kirstie Sands
September 23, 2026
11:55 AM























