' 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.
What Is SlugFest, the npm Trusted Publishing Vulnerability?
Deanna Ritchie
October 22, 2026
1:00 PM
What Is VS Code Agent Sandboxing? Microsoft’s New AI Agent Security Layer Explained
Steve Gickling
October 21, 2026
12:44 PM
Meta Muse Wonder: Pricing, Benchmarks, and What It Means for Developers
Rashan Dixon
October 20, 2026
7:56 AM
What Are GitHub Actions Workflow Lockfiles?
Deanna Ritchie
October 19, 2026
9:52 AM
What Is Grok Voice 3.0? xAI’s New Speech-to-Speech Model Explained
Steve Gickling
October 16, 2026
10:27 AM
Google’s Gemini Argon Wins Through Reach, Not Revolution
Joe Rothwell
October 15, 2026
10:50 AM
What Is the GhostApproval Vulnerability in AI Coding Assistants?
Johannah Lopez
October 15, 2026
8:09 AM
Startup Challenges DoorDash With $1 Delivery Fee
Steve Gickling
October 14, 2026
4:01 PM
AI Insiders Urge New York Oversight
Sumit Kumar
October 14, 2026
3:03 PM
Pro-AI Political Group Builds Bipartisan War Chest
Steve Gickling
October 14, 2026
1:36 PM
Prysm Capital Leader Links Parenting to Investing
Sumit Kumar
October 14, 2026
11:43 AM
McDonald’s Faces Antitrust Suit Over AI Pricing
Rashan Dixon
October 14, 2026
11:11 AM
OpenAI Addresses Australian Health Site Hack Probe
Rashan Dixon
October 14, 2026
11:04 AM
Industry Leaders Sign White House AI Accord
Kirstie Sands
October 14, 2026
10:37 AM
What Is the AgentCorruption Vulnerability in AWS AgentCore?
Priya Nandakumar
October 14, 2026
7:39 AM
Lincoln Lab Tracks AI Hardware Since 2018
Rashan Dixon
October 13, 2026
2:54 PM
Divided Court Rejects AI Lab’s Rights Claims
Rashan Dixon
October 13, 2026
11:29 AM
Countries Eye Drones to Boost Rainfall
Steve Gickling
October 13, 2026
11:09 AM
UK Watchdog Investigates Recruitment Robo Calls
Kirstie Sands
October 13, 2026
10:14 AM
Nexstrom Raises Funds for 2D Chip Equipment
Sumit Kumar
October 13, 2026
9:36 AM
Atlassian Deepens OpenAI Ties, Retains AI Choice
Deanna Ritchie
October 13, 2026
9:17 AM
AI’s Real Race Is Utility, Not Intelligence
Joe Rothwell
October 13, 2026
8:12 AM
What Is Mistral Large 4? Mistral AI’s Trillion-Parameter Open Model Explained
Noah Nguyen
October 13, 2026
7:44 AM
What Is ReviewBench? GitHub’s AI Code Review Benchmark Explained
Johannah Lopez
October 12, 2026
8:24 AM
Comfort Should Drive the Ultimate Gaming Setup
Joe Rothwell
October 10, 2026
7:44 AM





















