' 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.
US Rig Count Hits Four-Month Low
Steve Gickling
March 6, 2026
11:51 AM
FinTech Trends: Why Debt Collection Software Is Becoming Central to AR Automation
Amelia Blackwood
March 6, 2026
10:43 AM
Government iPhone Exploits Reach Cybercriminals
Sumit Kumar
March 6, 2026
9:37 AM
Claude Sonnet 4.6 Narrows Gap With Opus
Rashan Dixon
March 6, 2026
9:28 AM
6 Signals Your System Is Sliding Into Operational Drift
Steve Gickling
March 5, 2026
4:56 PM
Six Reasons Your AI Prototype Fails in Production
Rashan Dixon
March 5, 2026
4:46 PM
7 Early Signs Your AI Guardrails Won’t Hold in Production
Kirstie Sands
March 5, 2026
4:37 PM
How to Scale Search Infrastructure for High-Query Volumes
Sumit Kumar
March 5, 2026
4:21 PM
Technical Influence vs Authority in Engineering Teams
Steve Gickling
March 5, 2026
4:09 PM
Optical Links Challenge Copper In Data Centers
Rashan Dixon
March 5, 2026
3:48 PM
Empathy Guides Rosalyn Engelman’s Partnership
Rashan Dixon
March 5, 2026
3:25 PM
Apple M5 Chips Target On-Device AI
Sumit Kumar
March 5, 2026
2:41 PM
Sophia Space Raises $10 Million Seed
Steve Gickling
March 5, 2026
2:29 PM
Charles Payne Hosts Investor Town Hall
Kirstie Sands
March 5, 2026
2:16 PM
Xiaomi Highlights New Tech At MWC
Steve Gickling
March 5, 2026
2:13 PM
Berkshire Hathaway Q4 Profit Falls Nearly 30 Percent
Deanna Ritchie
March 5, 2026
2:04 PM
Amazon Debuts AI Dynamic Canvas for Sellers
Sumit Kumar
March 5, 2026
9:13 AM
Phones Are Ready For Serious Offline AI
Joe Rothwell
March 5, 2026
8:10 AM
4 Architectural Decisions That Shape Reliable RAG Systems
Rashan Dixon
March 4, 2026
4:47 PM
OpenAI Chair Sees AI Reshaping Work
Sumit Kumar
March 4, 2026
1:21 PM
Venezuelan Oil Rebranded As Brazilian To China
Steve Gickling
March 4, 2026
1:05 PM
OpenAI Defends Safeguards In Defense Deal
Sumit Kumar
March 4, 2026
12:31 PM
Samsung Brings Phone-Based Door Unlocking
Deanna Ritchie
March 4, 2026
12:21 PM
Smartphones Deliver Net Gains, Data Shows
Steve Gickling
March 4, 2026
10:23 AM
Asking AI Chatbots Changes How We Learn
Rashan Dixon
March 4, 2026
10:10 AM






