' 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 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.
About Our Journalist
Charlie Frank
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. View Author India’s rise in space exploration with private corporations
Johannah Lopez April 25, 2024 8:42 AM Walmart partners with fintech One for installment payment service
Johannah Lopez April 25, 2024 7:59 AM Biden administration bans noncompete agreements nationwide
April Isaacs April 25, 2024 7:01 AM Media mogul poised for $1 billion boost if shares surge
Cameron Wiggins April 24, 2024 5:19 PM Bitcoin miners’ strategy stabilizes market pre-halving
Noah Nguyen April 24, 2024 5:12 PM Digital banking tackles fraud with advanced methods
Johannah Lopez April 24, 2024 1:55 PM Wealth accumulation: Path to personal freedom and societal impact
Cameron Wiggins April 24, 2024 1:25 PM Japan’s finance minister warns of currency market intervention
Rashan Dixon April 24, 2024 1:14 PM TabaPay set to acquire Synapse’s assets
April Isaacs April 24, 2024 11:58 AM Baton Rouge Entrepreneurship Week 2024 announced
Cameron Wiggins April 24, 2024 11:36 AM Netherlands thriving in European venture capital growth
Noah Nguyen April 23, 2024 5:42 PM Fintech startup Ramp sees formidable growth
Cameron Wiggins April 23, 2024 5:14 PM Is Bitcoin the New Gold? Understanding Cryptocurrency as a Hedge Against Inflation
Rashan Dixon April 23, 2024 4:05 PM Zipline delivers millionth order, aims higher
Rashan Dixon April 23, 2024 3:49 PM Embracer Group splits into three, boosts efficacy
Johannah Lopez April 23, 2024 1:58 PM Predicted 2025 COLA sees modest growth
Noah Nguyen April 23, 2024 1:50 PM Unexpected eviction unsettles Indianapolis businesses
Cameron Wiggins April 23, 2024 11:46 AM Final April disability payment scheduled for release
Johannah Lopez April 23, 2024 8:08 AM Social Security amends SSI eligibility for 2024
Johannah Lopez April 23, 2024 8:01 AM Silver tsunami presents opportunity for young entrepreneurs
Johannah Lopez April 23, 2024 8:00 AM Unexpected eviction disrupts Indianapolis businesses
Cameron Wiggins April 23, 2024 7:51 AM Embracer Group restructures into three entities
April Isaacs April 23, 2024 7:07 AM Mercedes-AMG unveils powerful, innovative 2025 GT 63 S E Performance
Johannah Lopez April 22, 2024 5:45 PM Google poised for notable organizational changes
Johannah Lopez April 22, 2024 5:29 PM Merging Catholic faith with entrepreneurial education
April Isaacs April 22, 2024 3:59 PM