' 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.
$30-an-Hour Humanoid Robots Clean San Francisco Homes
Kirstie Sands
September 1, 2026
4:57 PM
Chipmaker’s $96 Billion Quarter Beats Forecasts
Rashan Dixon
September 1, 2026
4:10 PM
Belgian Startup Launches Modular Cargo Motorcycle
Sumit Kumar
September 1, 2026
4:07 PM
AI Regulation Race Exposes Policy Divides
Rashan Dixon
September 1, 2026
3:03 PM
Snowflake Adds Automated AI Model Routing
Steve Gickling
September 1, 2026
2:23 PM
Hidden Observatories Pursue Elusive Cosmic Particles
Sumit Kumar
September 1, 2026
12:52 PM
New $399 Smartwatch Expands Health Tracking
Deanna Ritchie
September 1, 2026
11:09 AM
Open AI Models Are Closing the Gap
Joe Rothwell
September 1, 2026
8:56 AM
Microservices vs Monolith: How to Choose in 2026
Rashan Dixon
September 1, 2026
8:00 AM
US President Claims Control Over Oil Reserves
Deanna Ritchie
August 31, 2026
4:40 PM
Meta Presses Rivals on Child Safety Rules
Steve Gickling
August 31, 2026
4:21 PM
Nashville Data Center Proposal Draws Resident Scrutiny
Kirstie Sands
August 31, 2026
4:21 PM
Building Voice-Enabled Applications: Where a Text to Speech API Fits
Priya Nandakumar
August 31, 2026
2:29 PM
Fortitude Mining Buys 12.5 MW Facility
Sumit Kumar
August 31, 2026
1:22 PM
Electric Equipment Shift Falls Behind Expectations
Steve Gickling
August 31, 2026
12:19 PM
Presidential AI Challenge Spotlights Student Tools
Rashan Dixon
August 31, 2026
11:21 AM
Astronomers Prepare Test for Earthlike Planet Hunt
Sumit Kumar
August 31, 2026
11:01 AM
What Is an API? A Plain-English Guide for Business Leaders
Rashan Dixon
August 31, 2026
8:00 AM
Apple’s Foldable iPhone Looks Increasingly Inevitable
Joe Rothwell
August 31, 2026
7:51 AM
API Design Principles Every Team Should Follow in 2026
Rashan Dixon
August 30, 2026
8:00 AM
How to Become a DevOps Engineer: A Realistic 2026 Roadmap
Rashan Dixon
August 29, 2026
8:00 AM
Reservoir Builds Predictive Home Water Heater
Steve Gickling
August 28, 2026
4:05 PM
Huawei Adoption Persists Despite US Restrictions
Kirstie Sands
August 28, 2026
3:26 PM
GEN-1.5 Learns Tasks From Seconds of Data
Rashan Dixon
August 28, 2026
3:12 PM
Apple AirPods Leak Signals Privacy-First Cameras
Sumit Kumar
August 28, 2026
3:12 PM





















